foreach/iota countdown

Timon Gehr timon.gehr at gmx.ch
Mon Feb 17 13:25:03 PST 2014


On 02/17/2014 10:12 PM, simendsjo wrote:
>
> Ok, I yield. I just happened to write
>    foreach(i; 10 .. 0)
> and was suprised that it didn't give any warnings or errors.
>
> But I still somewhat stand by my point: Dead code is illegal in D,

(No it is not. Some forms of dead code are detected by DMD, but only 
with the -w switch.)

> and this is code that will never run, hence dead code.

The following does not give any warnings or errors either:

void main(){ for(int i=10;i<0;i++){ } }



More information about the Digitalmars-d-learn mailing list