Topic: Namespace issues for `write
Author: kanze@gabi-soft.fr (J. Kanze)
Date: 1998/05/24 Raw View
fjh@cs.mu.OZ.AU (Fergus Henderson) writes:
|> jkanze@otelo.ibmmail.com writes:
|>
|> >I thought that write was in the user namespace,
|>
|> Correct.
|>
|> > in which case, the
|> >implementation doesn't have a right to provide it.
|>
|> That doesn't quite follow.
|>
|> An implementation is free to include additional libraries or library
|> functions that use names in the user namespace rather than the
|> implementation namespace, so long as the user is not forced to use
|> these libraries.
An implementation is free to offer whatever extensions it wants (nested
functions, etc), provided that these extensions are "turned off" in
compatible mode. With regards to standard C++, however, the presence of
such extensions implies that the language is no longer C++.
This answer, of course, only applies to comp.std.c++, where the subject
of discussion is standard C++. We all know that all vendors offer
"extensions", at least in the library. We also all know that if our
goal is to create portable working programs with a minimum of problems,
rather than to argue standards issues, it is better to avoid global
functions named write, or anything named far -- although things are
improving in this respect.
--
James Kanze +33 (0)1 39 23 84 71 mailto: kanze@gabi-soft.fr
GABI Software, 22 rue Jacques-Lemercier, 78000 Versailles, France
Conseils en informatique orient e objet --
-- Beratung in objektorientierter Datenverarbeitung
[ Send an empty e-mail to c++-help@netlab.cs.rpi.edu 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://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: fjh@cs.mu.OZ.AU (Fergus Henderson)
Date: 1998/05/22 Raw View
jkanze@otelo.ibmmail.com writes:
>I thought that write was in the user namespace,
Correct.
> in which case, the
>implementation doesn't have a right to provide it.
That doesn't quite follow.
An implementation is free to include additional libraries or library
functions that use names in the user namespace rather than the
implementation namespace, so long as the user is not forced to use
these libraries.
Typically POSIX systems will define write() as an ELF "weak" alias for
__write(), or equivalent. If the user's program defines write(), then
this definition is used in preference to the one in the system
library. But if the user's program refers to write() and does not give
a definition for it, then the one in the system library will be used.
This all conforms to the C and C++ standards.
The C++ standard has no requirement for a diagnostic in programs with
undefined references. (Even if it did, I think the requirement
might be toothless: the implementation could argue that the program
you submitted included the definition of write() in the system library.)
--
Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh@128.250.37.3 | -- the last words of T. S. Garp.
[ Send an empty e-mail to c++-help@netlab.cs.rpi.edu 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://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: Niall Smart <njs3@doc.ic.ac.uk>
Date: 1998/05/25 Raw View
J. Kanze wrote:
> fjh@cs.mu.OZ.AU (Fergus Henderson) writes:
> |> jkanze@otelo.ibmmail.com writes:
> |>
> |> >I thought that write was in the user namespace,
> |> Correct.
> |> > in which case, the
> |> >implementation doesn't have a right to provide it.
> |>
> |> That doesn't quite follow.
> |>
> |> An implementation is free to include additional libraries or library
> |> functions that use names in the user namespace rather than the
> |> implementation namespace, so long as the user is not forced to use
> |> these libraries.
>
> An implementation is free to offer whatever extensions it wants (nested
> functions, etc), provided that these extensions are "turned off" in
> compatible mode. With regards to standard C++, however, the presence of
> such extensions implies that the language is no longer C++.
There is a discussion of the issues which arise when vendor supplied
extensions pollute the namespace and the way the TenDRA compiler deals
with this available at:
http://alph.dera.gov.uk/TenDRA/port/port1.html
if you are interested.
Regards,
Niall
[ Send an empty e-mail to c++-help@netlab.cs.rpi.edu 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://reality.sgi.com/austern_mti/std-c++/faq.html ]