This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Strange Scope effects
- From: Joe Buck <Joe dot Buck at synopsys dot COM>
- To: Thomas Schoebel-Theuer <schoebel at informatik dot uni-stuttgart dot de>
- Cc: gcc at gcc dot gnu dot org,Thomas Schoebel-Theuer <schoebel at eiche dot informatik dot uni-stuttgart dot de>
- Date: Tue, 3 Aug 2004 09:27:05 -0700
- Subject: Re: Strange Scope effects
- References: <200408031623.i73GN92r001286@eiche.informatik.uni-stuttgart.de>
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.