Topic: POSIX namespace (was: using namespace std;)
Author: clamage@Eng.Sun.COM (Steve Clamage)
Date: 1998/11/13 Raw View
ncm@nospam.cantrip.org (Nathan Myers) writes:
>Craig Thrall<cthrall@rocketmail.com> wrote:
>>
>>>> This might be slightly off-topic, but does anyone have any idea what
>>>> namespace, if any, the POSIX names are going to wind up in?
>>>
>>>As far as I know, no vendor has yet reached a firm decision. This
>>>issue is still under discussed.
>>
>>Another slightly off-topic question: any idea when the Sun Workshop C++
>>compiler will support the namespace keyword?
>Probably not until this issue is resolved.
Sun C++ 5.0, now in beta test, supports namespaces. All the
"extra" stuff (like POSIX) is in the global namespace because
there is no other place to put it.
Any unilateral decisions we made about namespaces might need to
be done differently later. Leaving the names in the global
namespace assures compatibility with C code using the names.
On a related note, the <cname> form of the standard C headers
contain nothing outside what the standard requires. The <name.h>
forms contain all the extra stuff that C programs see, with
just the standard items going into namespace std.
If an when these other namespace issues are resolved, we can
add namespaces with the appropriate contents.
--
Steve Clamage, stephen.clamage@sun.com
---
[ 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://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: "Craig Thrall" <cthrall@rocketmail.com>
Date: 1998/11/10 Raw View
>> This might be slightly off-topic, but does anyone have any idea what
>> namespace, if any, the POSIX names are going to wind up in?
>
>As far as I know, no vendor has yet reached a firm decision. This
>issue is still under discussed.
Another slightly off-topic question: any idea when the Sun Workshop C++
compiler will support the namespace keyword? I sent them some mail, but
just got back a link to the page that had the latest version of the
compiler...
Thanks,
Craig
[ 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://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: Email_To::.Hans.Olsson@dna.lth.se (Hans Olsson)
Date: 1998/11/10 Raw View
In article <727r8a$g3q$1@shell7.ba.best.com>,
Nathan Myers <ncm@nospam.cantrip.org> wrote:
>The goal will probably be for extension names to be bound in versioned
>namespaces identified according to the standardizing body, perhaps
>something like posix94::fork().
Adding posix as a namespace alias for posix94 (or posix1994?)
seems like a logical use of namespace aliases.
If this becomes the standard it would seem logical to also
make namespace std an alias refering to the current C++ standard.
Unfortunately it seems as though it is already too late for this.
(Or what would happen with 'namespace std{};using namespace std;'?)
--
// Home page http://www.dna.lth.se/home/Hans_Olsson/
// Email To..Hans.Olsson@dna.lth.se [Please no junk e-mail]
---
[ 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://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: stephen.clamage@sun.com (Steve Clamage)
Date: 1998/11/10 Raw View
David R Tribble <david.tribble@noSPAM.central.beasys.com> writes:
>This might be slightly off-topic, but does anyone have any idea what
>namespace, if any, the POSIX names are going to wind up in?
It would be up to the POSIX folks (and X/Open and other groups)
to specify C++ bindings. The C++ Committee has not so far
taken any steps to recommend namespace bindings to other
standards groups, but may do so in the future.
Until then, I would expect all the names to wind up in the global
namespace. Since all C++ library names are in namespace std,
there won't be any direct conflicts. One can only hope that the
C bindings specified by POSIX et. al. will not conflict with C9X.
--
Steve Clamage, stephen.clamage@sun.com
[ 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://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: stephen.clamage@sun.com (Steve Clamage)
Date: 1998/11/10 Raw View
"Craig Thrall" <cthrall@rocketmail.com> writes:
>Another slightly off-topic question: any idea when the Sun Workshop C++
>compiler will support the namespace keyword? I sent them some mail, but
>just got back a link to the page that had the latest version of the
>compiler...
Sun C++ 5.0 is in beta test, and supports essentially the
complete standard, namespaces in particular.
--
Steve Clamage, stephen.clamage@sun.com
[ 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://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: ncm@nospam.cantrip.org (Nathan Myers)
Date: 1998/11/11 Raw View
Hans Olsson<Email_To::.Hans.Olsson@dna.lth.se> wrote:
>Nathan Myers <ncm@nospam.cantrip.org> wrote:
>>The goal will probably be for extension names to be bound in versioned
>>namespaces identified according to the standardizing body, perhaps
>>something like posix94::fork().
>
>Adding posix as a namespace alias for posix94 (or posix1994?)
>seems like a logical use of namespace aliases.
Yes, that has been suggested.
>If this becomes the standard it would seem logical to also
>make namespace std an alias refering to the current C++ standard.
>Unfortunately it seems as though it is already too late for this.
>(Or what would happen with 'namespace std{};using namespace std;'?)
If it was a mistake to use the linkage-name "std", the mistake
probably won't be repeated in the next revision. However, the code
Hans suggested is already too common even to consider breaking, so
anything new introduced next time will probably not be in std.
--
Nathan Myers
ncm@nospam.cantrip.org http://www.cantrip.org/
[ 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://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: ncm@nospam.cantrip.org (Nathan Myers)
Date: 1998/11/11 Raw View
Craig Thrall<cthrall@rocketmail.com> wrote:
>
>>> This might be slightly off-topic, but does anyone have any idea what
>>> namespace, if any, the POSIX names are going to wind up in?
>>
>>As far as I know, no vendor has yet reached a firm decision. This
>>issue is still under discussed.
>
>Another slightly off-topic question: any idea when the Sun Workshop C++
>compiler will support the namespace keyword?
Probably not until this issue is resolved.
--
Nathan Myers
ncm@nospam.cantrip.org http://www.cantrip.org/
---
[ 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://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: David R Tribble <david.tribble@noSPAM.central.beasys.com>
Date: 1998/11/09 Raw View
Steve Clamage wrote:
> Section D.5, "Standard C library headers":
> "Each C header, whose name has the form name.h, behaves as if each
> name placed in the Standard library namespace by the corresponding
> cname header is also placed within the namespace scope of the
> namespace std and is followed by an explicit using-declaration
> (7.3.3)".
>
> In other words, if you include one of the ".h" forms of the C
> library headers, you are supposed to find the names of all
> types, objects, and functions in namespace std and also in
> the global namespace.
This might be slightly off-topic, but does anyone have any idea what
namespace, if any, the POSIX names are going to wind up in? I see
three possibilities:
1. Global namespace. (So 'fork()' stays as '::fork()'.)
2. The standard namespace. (So 'fork()' becomes 'std::fork()'.)
3. A new "system" namespace. (So 'fork()' becomes 'sys::fork()',
or something like it.)
(Note: The 'fork' function is declared in <unistd.h>.)
Since POSIX is strictly C (currently), I assume that (1) is the best
assumption I can make for the near future. But can someone answer
this with more certainty?
-- David R. Tribble, dtribble@technologist.com --
[ 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://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: Francis Glassborow <francis@robinton.demon.co.uk>
Date: 1998/11/10 Raw View
In article <36475A09.327D@noSPAM.central.beasys.com>, David R Tribble
<david.tribble@noSPAM.central.beasys.com> writes
>1. Global namespace. (So 'fork()' stays as '::fork()'.)
>2. The standard namespace. (So 'fork()' becomes 'std::fork()'.)
>3. A new "system" namespace. (So 'fork()' becomes 'sys::fork()',
> or something like it.)
well I would prefer namespace posix;
Francis Glassborow Chair of Association of C & C++ Users
64 Southfield Rd
Oxford OX4 1PA +44(0)1865 246490
All opinions are mine and do not represent those of any organisation
---
[ 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://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: ncm@nospam.cantrip.org (Nathan Myers)
Date: 1998/11/10 Raw View
David R Tribble <dtribble@technologist.com> wrote:
>This might be slightly off-topic...
It is very much ON-topic.
> but does anyone have any idea what
>namespace, if any, the POSIX names are going to wind up in? I see
>three possibilities:
>
>1. Global namespace. (So 'fork()' stays as '::fork()'.)
>2. The standard namespace. (So 'fork()' becomes 'std::fork()'.)
>3. A new "system" namespace. (So 'fork()' becomes 'sys::fork()',
> or something like it.)
>
>(Note: The 'fork' function is declared in <unistd.h>.)
>
>Since POSIX is strictly C (currently), I assume that (1) is the best
>assumption I can make for the near future. But can someone answer
>this with more certainty?
This is an area of active discussion in the C++ committee, and is
likely to be addressed in a committee Technical Report. There are
some technical problems. fork() is easier than the others, because
it doesn't appear in a standard header. The names specified by
POSIX (or ANSI C!) to appear in standard C headers, in violation of
existing C and C++ standards, are tougher. For an interesting example,
consider the C++ stream std::clog and the proposed C9x function clog()
(which will _not_ overload nicely).
Different standards bodies already define different semantics for the
same name, so things are messy already.
The goal will probably be for extension names to be bound in versioned
namespaces identified according to the standardizing body, perhaps
something like posix94::fork(). The main technical problem is struct
tags, which C headers tend to "forward declare" in global space
independently of the defining header, and which as global type names
would (under normal rules) mangle differently into function names
using them, resulting in link errors.
We may need to recommend that implementers recognize another
'extern "..." {}' space to define such types in. If anybody has
insight into how to proceed on this, it would be most welcome.
Early drafts of the technical report will be very influential,
because implementers need guidance immediately.
--
Nathan Myers
ncm@nospam.cantrip.org http://www.cantrip.org/
---
[ 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://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: Matt Austern <austern@sgi.com>
Date: 1998/11/10 Raw View
David R Tribble <david.tribble@noSPAM.central.beasys.com> writes:
> This might be slightly off-topic, but does anyone have any idea what
> namespace, if any, the POSIX names are going to wind up in? I see
> three possibilities:
>
> 1. Global namespace. (So 'fork()' stays as '::fork()'.)
> 2. The standard namespace. (So 'fork()' becomes 'std::fork()'.)
> 3. A new "system" namespace. (So 'fork()' becomes 'sys::fork()',
> or something like it.)
>
> (Note: The 'fork' function is declared in <unistd.h>.)
>
> Since POSIX is strictly C (currently), I assume that (1) is the best
> assumption I can make for the near future. But can someone answer
> this with more certainty?
As far as I know, no vendor has yet reached a firm decision. This
issue is still under discussed.
---
[ 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://reality.sgi.com/austern_mti/std-c++/faq.html ]