Topic: Confusion about toupper()
Author: Allan W <allan_w@my-dejanews.com>
Date: Fri, 29 Apr 2005 14:39:28 +0000 (UTC) Raw View
> Matthias Hofmann <hofmann@anvil-soft.com> writes:
> > I see. But when does a name or declaration have namespace scope? In
other
> > words, is it possible for a name to be available in the global
namespace
> > without having namespace scope?
Llewelly wrote:
> I really doubt that's possible. If you're interested, the relevant
std
> sections are 3.3 and 3.4 .
It's possible. Macro names are available in the global namespace -- and
all
other namespaces. (That's why they're considered evil.)
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
Author: kuyper@wizard.net
Date: Mon, 25 Apr 2005 06:15:48 +0000 (UTC) Raw View
Matthias Hofmann wrote:
> "Llewelly" <llewelly.at@xmission.dot.com> schrieb im Newsbeitrag
> news:86sm1nwvta.fsf@zorthluthik.foo.bar...
..
> I would be glad if someone could clarify this for me, too. I got no
idea
> what a "name of namespace scope in the gloabal namespace" is supposed
to
> mean, which makes it even harder for me to understand. How can a name
of
> namespace scope be in the global namespace?
The global namespace is, as it's name implies, a namespace. Therefore,
when a declaration has namespace scope, and it's not inside any other
namespace, then the namespace that defines it's scope is the global
namespace.
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
Author: Llewelly <llewelly.at@xmission.dot.com>
Date: Mon, 25 Apr 2005 10:19:20 CST Raw View
Matthias Hofmann <hofmann@anvil-soft.com> writes:
> "Llewelly" <llewelly.at@xmission.dot.com> schrieb im Newsbeitrag
> news:86sm1nwvta.fsf@zorthluthik.foo.bar...
> >
>
> [snip]
>
> >
> > What about 17.4.3.1.3/5:
> >
> > # Each function signature from the Standard C library declared
> > # with external linkage is reserved to the implementation for use
> > # as a function signature with both extern "C" and extern "C++"
> > # linkage,168) or as a name of namespace scope in the global
> > # namespace.
> >
> > In the past I've interpreted this as granting library implementators
> > permission provide a function definition for names such as
> > ::toupper(), regardless of whether <cxxx> or <xxx.h> was included
> > at all. Yet I can't imagine someone opening issue 456 if that was
> > the case. So I don't understand it at all, it seems.
> >
> > What does 17.4.3.1.3/5 mean?
>
> I would be glad if someone could clarify this for me, too. I got no idea
> what a "name of namespace scope in the gloabal namespace" is supposed to
> mean, which makes it even harder for me to understand. How can a name of
> namespace scope be in the global namespace?
I don't think this clears up the issue of whether or not 17.4..3.1.3/5
allows library implementators to leave C library names in the
global namespace, but it seems to me what 'name of namespace scope
in the global namespace' is supposed to mean is cleared up by
3.3.5/3 :
# The outermost declarative region of a translation unit is also a
# namespace, called the global namespace. A name declared in the
# global namespace has global namespace scope (also called global
# scope). The potential scope of such a name begins at its point
# of declaration (3.3.1) and ends at the end of the translation
# unit that is its declarative region. Names with global namespace
# scope are said to be global.
The global scope is a namespace, though an implicit one, and the
phrase you question is thus not the contradiction it might
otherwise seem.
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
Author: AlbertoBarbati@libero.it (Alberto Barbati)
Date: Tue, 26 Apr 2005 05:21:12 GMT Raw View
Matthias Hofmann wrote:
>=20
> I would be glad if someone could clarify this for me, too. I got no ide=
a
> what a "name of namespace scope in the global namespace" is supposed to
> mean, which makes it even harder for me to understand. How can a name o=
f
> namespace scope be in the global namespace?
>=20
=A73.3.5/3: "The outermost declarative region of a translation unit is
also a namespace, called the global namespace. A name declared in the
global namespace has global namespace scope (also called global scope).
[...]"
That said, the sentence "name of namespace scope in the global
namespace" has a clear and unambiguous meaning to me. Sure, one may
wonder why such wording was chosen over the less redundant and
equivalent "name of global namespace scope", but I don't think it
deserves a DR for just that.
Alberto
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
Author: Matthias Hofmann <hofmann@anvil-soft.com>
Date: Tue, 26 Apr 2005 14:52:35 +0000 (UTC) Raw View
<kuyper@wizard.net> schrieb im Newsbeitrag
news:1114387759.297461.266510@o13g2000cwo.googlegroups.com...
> The global namespace is, as it's name implies, a namespace. Therefore,
> when a declaration has namespace scope, and it's not inside any other
> namespace, then the namespace that defines it's scope is the global
> namespace.
I see. But when does a name or declaration have namespace scope? In other
words, is it possible for a name to be available in the global namespace
without having namespace scope?
--
Matthias Hofmann
Anvil-Soft, CEO
http://www.anvil-soft.com - The Creators of Klomanager
http://www.anvil-soft.de - Die Macher des Klomanagers
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
Author: Llewelly <llewelly.at@xmission.dot.com>
Date: Wed, 27 Apr 2005 15:04:56 +0000 (UTC) Raw View
Matthias Hofmann <hofmann@anvil-soft.com> writes:
> <kuyper@wizard.net> schrieb im Newsbeitrag
> news:1114387759.297461.266510@o13g2000cwo.googlegroups.com...
>
> > The global namespace is, as it's name implies, a namespace. Therefore,
> > when a declaration has namespace scope, and it's not inside any other
> > namespace, then the namespace that defines it's scope is the global
> > namespace.
>
> I see. But when does a name or declaration have namespace scope? In other
> words, is it possible for a name to be available in the global namespace
> without having namespace scope?
I really doubt that's possible. If you're interested, the relevant std
sections are 3.3 and 3.4 .
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
Author: Llewelly <llewelly.at@xmission.dot.com>
Date: Wed, 20 Apr 2005 17:19:28 +0000 (UTC) Raw View
Pete Becker <petebecker@acm.org> writes:
> Matthias Hofmann wrote:
>
>> I am a little confused about toupper(). The way I interpret the standard,
>> including the header <cctype> should make toupper() available within
>> namespace std, and only within namespace std.
>
> That's what the standard says. It's often not reasonable to implement.
> There's an active defect report that's designed to relax this
> requirement to match common behavior.
[snip]
What about 17.4.3.1.3/5:
# Each function signature from the Standard C library declared
# with external linkage is reserved to the implementation for use
# as a function signature with both extern "C" and extern "C++"
# linkage,168) or as a name of namespace scope in the global
# namespace.
In the past I've interpreted this as granting library implementators
permission provide a function definition for names such as
::toupper(), regardless of whether <cxxx> or <xxx.h> was included
at all. Yet I can't imagine someone opening issue 456 if that was
the case. So I don't understand it at all, it seems.
What does 17.4.3.1.3/5 mean?
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
Author: Matthias Hofmann <hofmann@anvil-soft.com>
Date: Sun, 24 Apr 2005 21:39:30 +0000 (UTC) Raw View
"Llewelly" <llewelly.at@xmission.dot.com> schrieb im Newsbeitrag
news:86sm1nwvta.fsf@zorthluthik.foo.bar...
>
[snip]
>
> What about 17.4.3.1.3/5:
>
> # Each function signature from the Standard C library declared
> # with external linkage is reserved to the implementation for use
> # as a function signature with both extern "C" and extern "C++"
> # linkage,168) or as a name of namespace scope in the global
> # namespace.
>
> In the past I've interpreted this as granting library implementators
> permission provide a function definition for names such as
> ::toupper(), regardless of whether <cxxx> or <xxx.h> was included
> at all. Yet I can't imagine someone opening issue 456 if that was
> the case. So I don't understand it at all, it seems.
>
> What does 17.4.3.1.3/5 mean?
I would be glad if someone could clarify this for me, too. I got no idea
what a "name of namespace scope in the gloabal namespace" is supposed to
mean, which makes it even harder for me to understand. How can a name of
namespace scope be in the global namespace?
--
Matthias Hofmann
Anvil-Soft, CEO
http://www.anvil-soft.com - The Creators of Klomanager
http://www.anvil-soft.de - Die Macher des Klomanagers
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]