DMD 0.148 release
Ivan Senji
ivan.senji_REMOVE_ at _THIS__gmail.com
Sun Feb 26 23:49:12 PST 2006
Walter Bright wrote:
> "Ivan Senji" <ivan.senji_REMOVE_ at _THIS__gmail.com> wrote in message
> news:dttebh$2kqq$1 at digitaldaemon.com...
>
>>>Ever seen this:
>>>
>>>while(1)
>>
>>I sure did, and it scares the hell out of me :)
>
>
> Why? This is a practice I got into with C/C++, and I did it because 1 cannot
> be redefined by the preprocessor into something goofy. I.e., I *knew* what
> it was without having to go spelunking through header files.
>
The reason should be obvious. While(condition). Condition should be
boolean (true or false). 1 is neither. It is an integer. Using 1 (or any
other int) in a conditions place just isn't type safe.
What if you (as a compiler writer) decide (how ever unlikely) that true
should for some good reasons be implemented as being 0, or bool should
be implemented as float, or something else).
PS
No need to answer because I know this is one topic where we can't
convince you. :)
More information about the Digitalmars-d-announce
mailing list