Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve some of the -Wsign-compare warnings #422

Merged
merged 1 commit into from
Sep 19, 2023

Conversation

vpa1977
Copy link
Contributor

@vpa1977 vpa1977 commented Sep 15, 2023

During compilation libde265 produces a number of -Wsign-compare warnings:

~/git/libde265/libde265/decctx.h: In member function ‘slice_unit* image_unit::get_next_slice_segment(slice_unit*) const’:
~/git/libde265/libde265/decctx.h:226:20: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<slice_unit*>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
  226 |     for (int i=0; i<slice_units.size()-1; i++) {
      |                   ~^~~~~~~~~~~~~~~~~~~~~

this PR resolves some of them.

It replaces int with size_t for index variables and does not have a functional impact.

@farindk
Copy link
Contributor

farindk commented Sep 19, 2023

Thank you for the hard work.

I have to say that I'm no fan of size_t and consider this a design mistake of the std-library. It induces too many potential bugs (like in for-loops counting down) and that unsigned type spreads like cancer. I'd like to replace all of that with C++20 ssize() at a later point in time.

But all your changes are correct and non-problematic. Thus, I'm going to merge this.

@farindk farindk merged commit e10e488 into strukturag:master Sep 19, 2023
19 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants