DMD 0.148 release
Derek Parnell
derek at psych.ward
Mon Feb 27 14:43:16 PST 2006
On Mon, 27 Feb 2006 13:49:14 -0800, Walter Bright wrote:
> "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.
Agreed that the 'while(1)' idiom is not going anywhere, but Walter, which
would *you* write using D nowadays?
while(1) ...
or
while(true) ...
And why would you choose one form over the other?
--
Derek
(skype: derek.j.parnell)
Melbourne, Australia
"Down with mediocracy!"
28/02/2006 9:41:18 AM
More information about the Digitalmars-d-announce
mailing list