On 06/23/2010 05:44 PM, Alix Pexton wrote:
On 23/06/2010 16:24, Andrei Alexandrescu wrote:
On 06/23/2010 02:11 AM, Rick Trelles wrote:
Saving a keystroke, if it is in sound and clear way, is a plus.
At least the option to save the keystroke should be maintained.
I don't see now any advantages in using a pair of braces over a single
semicolon for a null statement, but why not keep it both ways?
We've all seen that requiring "{}" after the likes of if, while etc. are
very beneficial for readability. Then why not generalize that? As far as
I can tell the only vestigial use of the lone ";" is with labels that
don't precede any instruction (a very rare case). At this point, ";"
needs more justification to stay than to go.
I never liked the semicolon after while() but surely it wouldn't hurt to
interpret it as a null statement for those who are used to it.
By the way, I always glue the closing bracket to while
do{
. . .
}while( . . . ) // plus ";" if coding in C
Rick Trelles
That's great, except for those who enjoy "brace on its own line"
formatting style. For those, the "}while" would look jarring.
Andrei
I find that the "}while(..." style is the best way to highlight that you
are looking a a do...while and not a regular while loop, that it is
jarring is exactly the point ^^
Making the the semicolon on the end a requirement helps if you are
familiar with D and know it is not allowed on a regular while, but the
less enlightened might see a classic bug pattern where there isn't one
and try to "maintain" it away ><
In some ways I think it was a mistake in to reuse while in the first
place, but that was a decision that was made a loong time before D...
A...
Walter agreed to fix do-while to require a semicolon.
Andrei