This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [RFC] libstdc++/6720 and libstdc++/6671
> The standard does specify the effect of #include <cmath> in a program
> (with on exception, see below): it should make the declarations given
> in section 26 available to the program.
> The specification of all standard headers is given in 17.4.1.2.
>
> The exception is 17.4.3.2:
>
> *If* a file with a name equivalent to the derived file name for one of
> the C++ Standard Library headers is *not provided* as part of the
> implementation, *and* a file with that name is placed in any of the
> standard places for a source file to be included (16.2), the behavior
> is undefined.
Thank you for providing that reference.
I agree; we must do some kind of magic.
One possibility is to not provide a file with the right name. For example,
hardwire the full contents of the header file into the compiler, and then
not provide a header at all. But, we're certainly not going to go that far.
So, I agree, we need some special casing somewhere to make this work.
If we had a directory that contained *only* the standard headers, i.e,.
<cmath>, <cstdio>, <iostream>, etc., then could we just put it at
the front of the #include path? In other words, *prepend*
-I /path/to/dir to the front of the users command line?
That would make sure that those header files won. I guess it would
be better if this affected:
#include <cmath>
but not:
#include "cmath"
I'm not sure if cpplib can keep track of separate lists for the two
different syntaxes, but I suppose it could be taught to do so.
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com