This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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;
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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]