|
From: Sven R. <rei...@ma...> - 2002-11-23 16:39:42
|
On Sat, 23 Nov 2002, Baptiste Lepilleur wrote:
>
> I'd like if you could double check the list of 'scope generator'
> statement. I've found:
>
> if ( <scopeA ) <scopeB/> else <scopeC/> </scopeA>
> while ( <scopeA ) <scopeB/> </scopeA>
> for ( <scopeA; ... ;... ) <scopeB/> </scopeA>
> switch ( <scopeA ) <scopeB/> </scopeA>
> { <scopeA/> }
>
> {
> int x =3,<scopeX> y=2<scopeY>;
> ....
> </scopeY></scopeX>
> }
>
Declarations in if and while statements seem a bit suspicious to me; at
least they are bad style. The only possible application for me would be
something like
if (int result = complicatedFunction())
{
process(result);
};
However, I don't think this is legal since a declaration is not an
expression. On the other hand, gcc compiles this without any problems or
warnings.
I have a different (possibly simpler) approach to dealing with scopes in
finding references to local variables, which I'll describe on the Wiki. In
short, we can deal with this without introducing scope objects, just
exploiting the recursive descent behavior of the variable finder.
Sven.
--
Sven Reichard
Dept. of Math. Sci.
University of Delaware
rei...@ma...
|