Help on reading the standard!

B

Bo Yang

Hi,
I am now reading the C++ standard, and have some troubles.
What is unqualified name and what is qualified name?

I found the standard is too hard for non-english programmer!
 
H

Huck Phin

A qualified name is what combination and organization of letters,
numbers, and underscore you can use to declare a variable, function,
method, or class. To make it a qualified name, 2 things need to be
true:

1. In C++, you can use letters, digits, and underscore( _ ) in
declaring your variable name.
2. Your variable cannot start with a number.

3 examples of Qualified Names are:
myDog
my_dog
my_dog3

3 examples of Unqualified Names are:
123Dogs
1Dog1
$my_dog ( All Special Characters cannot be used except underscore )

Respectfully Submitted,
Huck

P.S. If you are having trouble reading the standard there are many
books out there for programmers of all different skill levels. You did
not ask about this, and we ( I am speaking for the collective, or
rather the groups here ) are always happy to give help whenever you
would like it, but it may save you a lot of frustration if it is a
programming expert reading level.
 
H

Huck Phin

A qualified name is what combination and organization of letters,
numbers, and underscore you can use to declare a variable, function,
method, or class. To make it a qualified name, 2 things need to be
true:

1. In C++, you can use letters, digits, and underscore( _ ) in
declaring your variable name.
2. Your variable cannot start with a number.

3 examples of Qualified Names are:
myDog
my_dog
my_dog3

3 examples of Unqualified Names are:
123Dogs
1Dog1
$my_dog ( All Special Characters cannot be used except underscore )

Respectfully Submitted,
Huck
 
I

Ian Collins

Bo said:
Hi,
I am now reading the C++ standard, and have some troubles.
What is unqualified name and what is qualified name?
In C++ names have scope. A fully qualified name is a combination of the
scope containing the name and the name. An unqualified name is the name
without the scope.

Any name declared with in a scope can be used unqualified within the
containing scope. Any name declared in a scope and used outside of the
containing scope has to be fully qualified.

for example:

namespace fred
{
const int x = 1;
}

namespace jim
{
const int x = 2;
const int y = x; // unqualified name, uses jim::x
const int z = fred::x; // use qualified name to access fred::x
}
I found the standard is too hard for non-english programmer!

You'd be surprised how many English speaking programmers find it hard!
That's why we have so many text books.
 
I

Ian Collins

Huck Phin wrote:

Please quote the context of the message you are replying to.
A qualified name is what combination and organization of letters,
numbers, and underscore you can use to declare a variable, function,
method, or class. To make it a qualified name, 2 things need to be
true:

1. In C++, you can use letters, digits, and underscore( _ ) in
declaring your variable name.
2. Your variable cannot start with a number.
No. This does not define a qualified name.
 
B

Bo Yang

Ian Collins :
In C++ names have scope. A fully qualified name is a combination of the
scope containing the name and the name. An unqualified name is the name
without the scope.

Any name declared with in a scope can be used unqualified within the
containing scope. Any name declared in a scope and used outside of the
containing scope has to be fully qualified.

for example:

namespace fred
{
const int x = 1;
}

namespace jim
{
const int x = 2;
const int y = x; // unqualified name, uses jim::x
const int z = fred::x; // use qualified name to access fred::x
}
Thank you, I got it now! Thanks!
You'd be surprised how many English speaking programmers find it hard!
That's why we have so many text books.
I feel contented after looking this...
 
G

Greg

Huck said:
A qualified name is what combination and organization of letters,
numbers, and underscore you can use to declare a variable, function,
method, or class. To make it a qualified name, 2 things need to be
true:

1. In C++, you can use letters, digits, and underscore( _ ) in
declaring your variable name.
2. Your variable cannot start with a number.

3 examples of Qualified Names are:
myDog
my_dog
my_dog3

3 examples of Unqualified Names are:
123Dogs
1Dog1
$my_dog ( All Special Characters cannot be used except underscore )

Er, no. The first group contains unqualified names while the second
group contains "ill-formed" names - that is, names that could not be
used in a C++ program.

A "qualified" name is a (legal) name prefixed with scope operator :):)
and usually a class or namespace name as well. Since the same name can
appear at different "scopes" in a C++ program, it is sometimes useful
to use the scope operator to "qualify" the name as the one belonging to
particular class or namespace - and not the identical name in some
other namespace or class (and which the compiler would otherwise select
if the name were not qualified.)

These are examples of qualified names:

A::b;
A::B::c
A::template X;
::a;

A qualified name always has a scope operator "::" before the name. An
"unqualfied" name has no scope operator - it's just a simple name.
Since it's not clear in which scope an unqualified name is declared, a
C++ compiler has to "look up" each unqualified name it encounters to
find a matching declaration.

Greg
 
N

Noah Roberts

Bo said:
Hi,
I am now reading the C++ standard, and have some troubles.
What is unqualified name and what is qualified name?

I found the standard is too hard for non-english programmer!

That's ok, it's hard for english speaking (and reading) programmers as
well.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,045
Latest member
DRCM

Latest Threads

Top