a warning to implement
Jeremy Sanders
jss@ast.cam.ac.uk
Wed Feb 6 02:00:00 GMT 2002
(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;
void f3()
{
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[9]).
>>
So it looks like there is divine permission for a warning :-) (yes I know
Bjarne is not the standard).
Jeremy
--
Jeremy Sanders <jss@ast.cam.ac.uk> http://www-xray.ast.cam.ac.uk/~jss/
Pembroke College, Cambridge. UK Institute of Astronomy, Cambridge. UK
More information about the Gcc
mailing list