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: Strange Scope effects


On Tue, Aug 03, 2004 at 06:23:09PM +0200, Thomas Schoebel-Theuer wrote:
> ({ // inner scope begins
>    int x = x; // parameter assignment, try to evaluate _once_
>    some code;
> })
> 
> AFAIK, in Ada the scope rules are will allow that. The x after the
> Ada := will refer to outer x, even while a new x is being defined at the
> inner scope.
> 
> In Gnu C, I get a stupid assignment of the _uninitialized_ inner
> x to itself.
> 
> I don't have access to the C99 standard. What is the required semantics?

GCC correctly implements the required semantics of C, even if it seems
stupid to you in this case.


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