Yet another slap on the hand by implicit bool to int conversions

Kagamin spam at here.lot
Mon Jun 20 02:26:01 PDT 2011


Andrej Mitrovic Wrote:

> if (mmioRead(hmmio, cast(LPSTR)&drum, DRUM.sizeof) != DRUM.sizeof)

How would you catch this bug:

if (mmioRead(hmmio, cast(LPSTR)&iFormat, DRUM.sizeof) != DRUM.sizeof)

If you didn't notice what you converted the code to, you probably forgot what's going on in this code. It has not that many braces to get lost in them.


More information about the Digitalmars-d mailing list