This is the mail archive of the
mailing list for the GCC project.
Re: a warning to implement
- From: Jeremy Sanders <jss at ast dot cam dot ac dot uk>
- To: gcc at gcc dot gnu dot org
- Date: Wed, 6 Feb 2002 09:55:14 +0000 (GMT)
- Subject: Re: a warning to implement
(apologies if you use threading - it's hard to reply to the digest mode)
Interestingly Bjarne Stroustrup writes in The C++ Programming Language
(Special Edition), Section 4.9.4:
The scope of a name starts at its point of declaration; that is, after the
complete declarator and before the initializer. This implies that a name
can be used even to specify its own initial value. For example:
int x = x; // perverse: initialise x with its own (unitialised) value
This is not illegal, just silly. A good compiler will warn if a variable
is used before it has been set (also see Section 5.9).
So it looks like there is divine permission for a warning :-) (yes I know
Bjarne is not the standard).
Jeremy Sanders <email@example.com> http://www-xray.ast.cam.ac.uk/~jss/
Pembroke College, Cambridge. UK Institute of Astronomy, Cambridge. UK