for in D versus C and C++

BCS ao at pathlink.com
Thu Mar 19 10:19:49 PDT 2009


Reply to Denis,

> On Thu, 19 Mar 2009 19:58:48 +0300, Alexander Pánek
> <alexander.panek at brainsware.org> wrote:
> 
>> Steve Teale wrote:
>> 
>>> Don Wrote:
>>> 
>>>> Steve Teale wrote:
>>>> 
>>>>> for (; a<b; a++);
>>>>> 
>>>>> is illegal in D.
>>>>> 
>>>>> Doesn't this break a lot of C and C++ code?
>>>>> 
>>>> It breaks a lot of broken C and C++ code.
>>>> 
>>> OK, that's possibly the case, but you know that among C programmers
>>> in  particular there was an absolute prohibition on typing more
>>> characters  than necessary.
>>> 
>> It's just one character more in D. Really just the closing curly
>> bracket  that adds up.
>> 
>> for(;;); vs. for(;;){}
>> 
> In D, you can for(;){} :p
> 

or

int i;
for(if(i%2) i++; i< 10; i++) {}





More information about the Digitalmars-d mailing list