M
murali.desikan
Hi,
[I posted this in comp.std.c++ but the post never appeared. So trying
here]
ISO/IEC 14882:2003 Section 3.4.1/13 has the following
[...] Names declared in the outermost block of the function definition
are not found when looked up in the scope
of a handler for the function-try-block. [Note: but function parameter
names are found. ]
I thought the following example illustrated the above point but all
the compilers (gcc 3.4.2, MS VC++ 2005, Comeau online compiler) I
tried it with accept the code without any errors.
int main()
{
int x;
try {
// ...
}
catch(...) {
int i = x; // Should lookup of 'x' fail here???
//...
}
return 0;
}
Please explain what the above sentence from 3.4.1/13 really implies
(possibly with a small code example).
Thanks,
Murali
[I posted this in comp.std.c++ but the post never appeared. So trying
here]
ISO/IEC 14882:2003 Section 3.4.1/13 has the following
[...] Names declared in the outermost block of the function definition
are not found when looked up in the scope
of a handler for the function-try-block. [Note: but function parameter
names are found. ]
I thought the following example illustrated the above point but all
the compilers (gcc 3.4.2, MS VC++ 2005, Comeau online compiler) I
tried it with accept the code without any errors.
int main()
{
int x;
try {
// ...
}
catch(...) {
int i = x; // Should lookup of 'x' fail here???
//...
}
return 0;
}
Please explain what the above sentence from 3.4.1/13 really implies
(possibly with a small code example).
Thanks,
Murali