Argiris Kirtzidis wrote:-

> +  //
> +  // C++ 6.4p3:
> +  // A name introduced by a declaration in a condition is in scope from its
> +  // point of declaration until the end of the substatements controlled by 
> the
> +  // condition.

I've read and reread the parts of the C++ standard, and I've just ended
up confused.

However I'm finding it hard to read this as saying a new scope is
created and entered.

For example, 

int a, b;

b is "in scope" from the character 'b' but you don't enter a new scope
when you see the 'b'.

In comparison C99 is very explicit that a whole new scope is created,
as is C++ for the controlled statements.  So I don't see it for the
outer statement in C++.

This matters with, for example,

void f(void)
{
  int x;

  if (int x = 1)
  {
  }
}

where I read the C++ standard as requiring a redefinition of x
error.

Neil.
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to