This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GCC 3.0.2: errno conflict.


On Sat, Dec 15, 2001 at 07:45:54PM -0800, Joe Buck wrote:
> 
> > | I think that the conclusion is that, since you did not include
> > | <errno.h> or <cerrno> explicitly, there is a bug.
> > 
> > No, the C++ standard explicitly grants right to standard headers
> > (except those inherited from C and the <cxxx> variants) to #include
> > any other header.  A well wriitten C++ program  should not make any
> > assumption about which header #includes which.  From that point of
> > view, I would say the testcase is ill-designed.
> 
> Are you saying, then, that "errno" is a reserved identifier in C++ for
> all programs that include any standard headers?  I am skeptical of this
> argument.  I suspect that the intent of the language you refer to was
> to  allow standard functions and classes to wind up defined.

The standard doesn't address linkage names, declared or not.
In C++ (unlike C) an undeclared function cannot be called at all.
 
> For one thing, it would mean that all C functions are in the global
> namespace, since, by your argument, any system header can include any
> other header, including the old C headers.

The C functions are not allowed to be implemented as macros in C++.
(They are allowed to be inline functions.)  The list of lower-case
names that may be macros -- and must be, there is no ambiguity on 
that point in C++ -- is very short.  (Of course there are lots of 
upper-case names that are macros.)

Some people argue that the C names *should* be treated as visible in 
global scope, because they are certainly available for linkage.  All 
agree that it doesn't say that now.

The specified relationship between the <c...> and the <...h> headers 
rules out the former including the latter.
 
> But perhaps we can ask the folks at comp.std.c++ what they think.

This has come up in committee several times before, in various guises.
The official resolution is always the same, once it is recognized.

Nathan Myers
ncm at cantrip dot org


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]