DMD 0.148 release

Walter Bright newshound at digitalmars.com
Mon Feb 27 13:49:14 PST 2006


"Ivan Senji" <ivan.senji_REMOVE_ at _THIS__gmail.com> wrote in message 
news:dtuatr$l0k$1 at digitaldaemon.com...
> Walter Bright wrote:
>> 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.

1 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).

That would break just about every C and C++ program in existence. Not going 
to happen. The reason I used 1 was because *it could never break* and 
because it has the property of being "inspectible." Inspectible means I can 
look at it and know what it does without having to refer to other things.

> PS No need to answer because I know this is one topic where we can't 
> convince you. :)

LOL, I agree with you there. 





More information about the Digitalmars-d-announce mailing list