Topic: semi colons after }
Author: franl@centerline.com (Fran Litterio)
Date: 31 Oct 92 12:35:15 Raw View
ark@alice.att.com (Andrew Koenig) writes:
> ddv@unix.brighton.ac.uk (Domenico De Vitto) writes:
>
> > There is no need to put a semi-colon after a closing brace, it's like putting
> > a remark after every code block for no reason except BAD PRACTICE to do this
> > as no-one else does and it obviously confused (at least) you.
>
> Indeed, it sometimes incorrect:
>
> if (x < 0) {
> x = -x;
> sign = 1;
> }; else // syntax error
> sign = 0;
And sometimes necessary:
struct foo {
int i;
} // Need a ';' here.
sub()
{
return 99;
}
--
franl@centerline.com || Fran Litterio, CenterLine Software R&D
617-498-3255 || 10 Fawcett St, Cambridge, MA, USA 02138-1110
"It's not the thing you fling, it's the fling itself." -- Chris Stevens
Author: am68@unix.brighton.ac.uk (AABStainer? AABSolutely!)
Date: 16 Oct 92 12:57:38 GMT Raw View
Can any body tell me why semi colons after closing braces for blocks
of code affect the performance of programs in C++?
I had a sort routine which didn't work until I removed the ;
any ideas
andy
Author: ddv@unix.brighton.ac.uk (Domenico De Vitto)
Date: 19 Oct 92 09:28:58 GMT Raw View
There is no need to put a semi-colon after a closing brace, it's like putting
a remark after every code block for no reason except BAD PRACTICE to do this
as no-one else does and it obviously confused (at least) you.
Somtimes clarity is a good reason for extra ;'s but rarely and in general you
should only put-em where needed. Compilers tend to get confused with then see
crap code written by lecturers who don't know WHY programs are bugger-hard to
modify.....
ps andy this article shouldn't be comp.stANDARd.c++, as some pin-heads get
strop about it.
Dom
Author: ark@alice.att.com (Andrew Koenig)
Date: 20 Oct 92 13:33:02 GMT Raw View
In article <1992Oct19.092858.2877@unix.brighton.ac.uk> ddv@unix.brighton.ac.uk (Domenico De Vitto) writes:
> There is no need to put a semi-colon after a closing brace, it's like putting
> a remark after every code block for no reason except BAD PRACTICE to do this
> as no-one else does and it obviously confused (at least) you.
Indeed, it sometimes incorrect:
if (x < 0) {
x = -x;
sign = 1;
}; else // syntax error
sign = 0;
--
--Andrew Koenig
ark@europa.att.com