The empty statement ";" - when is it useful?

Stewart Gordon smjg_1998 at yahoo.com
Sun Jul 26 16:14:10 PDT 2009


Andrei Alexandrescu wrote:
> D has ";" as the empty statement. In fact I think it's an empty 
> declaration because it can appear at top level.
<snip>

That's always been one of my peeves.  At least, ever since I discovered 
that preventing such common C typos as

     if (...);
     {
         ...
     }

isn't implemented by disallowing ";" as a statement altogether, even 
though at the time there was nothing in the spec to _allow_ it.

http://d.puremagic.com/issues/show_bug.cgi?id=327

Walter once claimed that it's useful for automatically generated code. 
Though I'm still not quite sure how.

Stewart.



More information about the Digitalmars-d mailing list