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: [RFC] libstdc++/6720 and libstdc++/6671


Gabriel Dos Reis wrote:
> Neil Booth wrote:
> | Gabriel Dos Reis wrote:
> | >
> | >     #include <cmath>
> | >     int main()
> | >     {
> | >        double x = std::sin(9.8);
> | >     }
> | >
> | > should not provoque compilation error just because there happens to be
> | > a file named cmath in the current directory.  Cure that problem and
> | > the symptoms with go away.
> |
> | I don't agree with your solution of special-casing certain header names,
>
> It is not me who is special-casing certain header names.  That special
> meaning of certain headers are built into the language.  Failure to
> provide the expected meaning is failure to implement the language.

I disagree on three grounds.

1.  Good software does not second-guess the user.  If the user has
specified -I. or -I/usr/include/g++-3/ext or whatever, they bloody
well meant it, for good or ill.  You can think of -I. as invoking a
non-conforming mode of the compiler if it makes you feel better.

2. Creating header files with the same names as system headers, and
injecting them into the search path ahead of the system headers, is
common practice -- to work around bugs or provide portability
wrappers.  In other words, I can guarantee that if we implement the
semantics you want, we will have users demanding it be un-done.

3. The list of headers you want special-cased is ill-defined.
Obviously it includes the headers defined by C89 and C++98.  Do you
propose to include C99 headers also?  What about POSIX.1, .1a, .1b,
etc? SUS v2? v3?  The Austin drafts?  The X11 reference spec?  And
what happens if the system in use does not include some of the headers
in the set you pick?

Nathan is correct:  This is entirely and only an issue of naming
conventions.  If the ext/ header names can be made not to clash with
the standard ones, well and good; if not, tell people not to use 
-I $(prefix)/include/g++-3/ext and forget it.

Note that the problem of <foo> including <bar> and getting <ext/bar>
can be dealt with by having foo use #include "bar", which puts the
directory containing foo at the head of the search path.  (Unless the
user provided -I-, but once again, if they did that they meant it.)

(I hope I have correctly understood that this problem only arises when
that -I switch is in use.  If not, please clarify.)

zw

p.s. I'm not on libstdc++, please cc: me directly on replies.


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