Skip to content

-Wsign-compare in image-pam.cpp #564

@ziemek99

Description

@ziemek99
image/image-pam.cpp:90:27: warning: comparison of integer expressions of different signedness: ‘ColorVal’ {aka ‘int’} and ‘unsigned int’ [-Wsign-compare]
   90 |                 if (pixel > maxval)
      |                     ~~~~~~^~~~~~~~
image/image-pam.cpp:106:27: warning: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Wsign-compare]
  106 |                 if (pixel > maxval)
      |                     ~~~~~~^~~~~~~~

Introduced in #532. The first warning is especially problematic because the definition of ColorVal can change depending on build options:

FLIF/src/image/image.hpp

Lines 36 to 40 in 0074d6f

#ifdef SUPPORT_HDR
typedef int32_t ColorVal; // used in computations
#else
typedef int16_t ColorVal; // at most 9-bit numbers + sign
#endif

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions