2009/8/28 Dmitry Timoshkov <dmitry at codeweavers.com>:
> "James McKenzie" <jjmckenzie51 at earthlink.net> wrote:
>>>> False positive, apparently the numbers are hardcoded as:
>>> 72 char msg[128];
>>> 88 msg[10 + 3 * 16] = ' '; // = 58<127
>>>>>>> Why not just say 58 instead of the complex math?
>>>>>> 89 msg[10 + 3 * 16 + 1 + 16] = '\0'; // = 75<127
>>>>>>>>>> Same here. Why not 75 instead of the math formula?
>> Because that's done that way to make it easier to understand
> the logic for the programmer. If a tool can't cope with it -
> that tool is broken.
I just took a look at the code, and I agree with Dmitry. In context,
these lines appear immediately after a loop structure that is
populating the array. The "10 + 3 * 16" calculated constants make
perfect sense in the context of the loop (note that there is also a "+
0" on line 82). Changing these to single constant values would make it
much harder for the casual observer to read.
Note that the compiler will optimise this to a single constant anyway.
Either way, it's not an actual *bug* unless the values are wrong.