Pay attention to your compiler warnings
Andy Lester
andy at petdance.com
Tue Aug 17 15:42:41 UTC 2010
Here's a swell little bug that GCC came across today:
src/string/primitives.c: In function ‘INTVAL Parrot_char_digit_value(Parrot_Interp, UINTVAL)’:
src/string/primitives.c:332:50: warning: logical ‘or’ of collectively exhaustive tests is always true [-Wlogical-op]
The offending code:
if ((character >= 0x30) || (character <= 0x39))
return character - 0x30;
That || should have been an &&. As written, it is always true.
I know that the compiler warnings are often a nuisance, and we can be tempted to Just Make Them Shut Up, but there's often good diagnostic information in there as well.
xoxo,
Andy
--
Andy Lester => andy at petdance.com => www.theworkinggeek.com => AIM:petdance
More information about the parrot-dev
mailing list