Add new comment

Kodak kodak_radc_load_raw function

This function has a rather curious construct in it. There is a variable "int c" and there is:

         for (r=0; r <= !c; r++)

I believe many (most?) C compilers these days are going to result in an integer value of -1. So this for loop iterates once or zero times.

This is enclosed in a "FORC3" construct, which iterates c from 0 to 2.

MS Visual Studio 2019 is (correctly, I believe) indicating that "r <= !c" is an improper use of a boolean. This appears to be in the latest released source code.

I understand the motivation for terseness and the hope that this optimizes into something really small by the compiler. Unfortunately, with C++ and the bool type this level of terseness leaves the compiler with a number of implicit conversions happening behind the scenes.
Would it be hugely different if this was "r <= ((c) ? -1 : 0)" instead? Or, some other construct which doesn't involve converting an int to a bool and then a bool to an int?