Steven Schveighoffer wrote:
where we don't want to (I've done it many times). This is one of those rare cases where people can easily type valid code that does not do what they want.

The reason I ask is because I sometimes do empty statements intentionally by placing a semicolon (surprised?). DMD doesn't allow me to do it, so I put {} as it asks.

In contrast, Microsoft C/C++ does(with opt. /Wall):
warning C4390: ';' : empty controlled statement found; is this the intent?

I think it's correct way it should be done.

And about the question of omitting semicolon. I don't like the optional use of it. In this respect I don't like the GO's way it inserts semicolons automatically by the lexer(!).

Just one excerpt from http://golang.org/doc/effective_go.html
One caveat. You should never put the opening brace of a control structure (if, 
for, switch, or select) on the next line. If you do, a semicolon will be 
inserted before the brace, which could cause unwanted effects. Write them like 
this

if i < f() {
    g()
}

not like this

if i < f()  // wrong!
{           // wrong!
    g()
}

I prefer ANSI(Allman) style(second example, wrong).
They want to force Java-like style which I dislike much.



--
Alex Makhotin,
the founder of BITPROX,
http://bitprox.com

Reply via email to