why ; ?

Jesse Phillips jessekphillips at gmail.com
Mon May 5 12:12:32 PDT 2008


On Mon, 05 May 2008 12:32:09 -0400, Tomasz Sowinski wrote:

> BCS Wrote:
> 
>> In "for(;;);" the trailing ; is a null statement.
> 
> I just did that and the compiler said: "use '{ }' for an empty
> statement, not a ';' "

Since putting ; at the end of statements is common writing a for
(...;...;...); would be common, and so D makes this invalid, using a ; to 
make an empty loop, that is why it says to use {} if you want one. BCS's 
example is just the same as doing a while(true){} though would not 
compile because of the ; at the end.



More information about the Digitalmars-d mailing list