Yet another slap on the hand by implicit bool to int conversions
Andrej Mitrovic
andrej.mitrovich at gmail.com
Mon Jun 20 10:11:41 PDT 2011
Btw, the reason why I've made a sloppy mistake was because the code was:
if (mmioRead (hmmio, (LPSTR) &drum, sizeof (DRUM)) != sizeof (DRUM))
sizeof(type) had to be converted to type.sizeof, and that's where I
screwed things up.
Maybe it was just an overreaction. This could be a rare bug.. But
sizeof is checkable at compile time, so a lint-like tool could catch
these comparisons that don't make much sense.
As for making bool->int a warning, it's probably overkill. Not even
GCC complains about it with all warnings turned on, so I guess it's
not a common error.
More information about the Digitalmars-d
mailing list