why ; ?
Sascha Katzner
sorry.no at spam.invalid
Mon May 5 04:45:52 PDT 2008
Tomasz Sowinski wrote:
> What's the reason of having lines end with a semicolon? Anything else
> than a legacy issue with C/C++?
>
> The only thing I can think of is having multiple statements in one
> line, but that only makes code unreadable. Wouldn't getting rid of ;
> improve readability?
No, you would never know if a statement is just a continuation from the
previous line or actually a new one.
An example:
int i
for (i=0; i<10; i++)
writefln(i)
Should this print all numbers from 1 to 9 or simply increment i ten
times and print "10"?
The only exception to this are IMO inline assembly statements, the
semicolons there are unnecessary and ugly. And since I'm accustomed to
write assembly without semicolons at the end I continuously forget them. ;)
[X] Vote to kick semicolons in asm statements!
LLAP,
Sascha
More information about the Digitalmars-d
mailing list