473,396 Members | 2,020 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Unqualified name lookup doubt (ISO/IEC-14882:2003 3.4.1/13)

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
Feb 5 '08 #1
2 1522
On Feb 6, 2:27 am, Pete Becker <p...@versatilecoding.comwrote:
This isn't a function-try-block. A function-try-block is a rather
unusual creature. Here's an example from the standard:
Thanks for the clarification. Guess I have to be more careful in
reading the standard since each term has a precise meaning.

Thanks,
Murali
Feb 5 '08 #2
On Feb 6, 2:28 am, Erik Wikström <Erik-wikst...@telia.comwrote:
>
I do not know what they mean by that sentence but what you have is not a
function-try-block, just a try-block. A function try block looks
something like this:
Thanks for the inputs. Based on this, I think the sentence from
3.4.1/13 becomes clear. Since the entire block of the function
definition in a function-try-block corresponds to a try block, any
declaration in that block will not be found in the scope of a handler
for that block.

Thanks,
Murali
Feb 5 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: philchen1978 | last post by:
Hi, I can compile the code below with GCC 3.4.2, because function g is a "dependent name". template<class T> void f1(T t) { g(t); }
1
by: Srini | last post by:
I was reading the "Exceptional C++" of Herb Sutter. In an example, he mentions the following. // In some library header: namespace N { class C{}; } int operator+(int i, N::C) { return i+1; }...
0
by: Ivan A. Kosarev | last post by:
Hello, There are three similar programs below. All of these use typedef names, qualified identifiers, class names and name lookup mechanism in various contexts. I found that most respect C++...
0
by: ketan | last post by:
Hi, While understanding name lookup using item 32 of EC++ ( Sutter ), i found error from gcc bit unclear. It will be great if anyone can help me. In short - compiler complains about...
5
by: Subhransu Sahoo | last post by:
Hi All, Does the C++ standard tell function overloading can't be done with the return types of two functions ? If so, is it true that the name mangling scheme does not take the return type into...
4
by: Wayne Shu | last post by:
Hey, guys. There is a problem. e.g. template <typename T> class foo { public: foo();
3
by: Fraser Ross | last post by:
10.2/2 of the C++ standard says this: "The following steps define the result of name lookup in a class scope, C. First, every declaration for the name in the class and in each of its base class...
3
by: WaterWalk | last post by:
Hello. Consider the following two examples: class Test1(object): att1 = 1 def func(self): print Test1.att1 // ok class Test2(object): att1 = 1 att2 = Test2.att1 // NameError: Name Test2...
2
by: Stefan Naewe | last post by:
Hi there. Given the following code, why is class B::A used at point //2 and not class ::A ? Does inheriting a class in a namespace put the names of that namespace into the "name pool" used for...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.