This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Implementation of libc functions in std::
- To: gcc at gcc dot gnu dot org
- Subject: Implementation of libc functions in std::
- From: Bernd Strieder <strieder at student dot uni-kl dot de>
- Date: Tue, 29 Aug 2000 19:47:03 +0200
- Organization: Universität Kaiserslautern
Hello,
in some of the recent snapshots I compiled and got to compile other
code, I noticed that although for example cstdlib is included the
funtions in there are not in std::. I looked further and found that
nothing is done to have those functions in namespace std. So the code I
tried to compile couldn't compile, although compliant to the standard.
The problem I see with that problem is as follows:
The functions in question ( e.g. sin, exp, rand, ...) are available
everywhere in the C-lib, perhaps as compiler inline code, in some cases.
So the worst thing to do is coding them. We want to use what is
available. The functions in the C-lib and probably those generated by
inline math facilities have extern "C" linkage. To be compatible with
the standard we need them with C++ linkage in namespace std.
My ideas to solve it are as follows:
* Write wrapper functions in the correct namespace, perhaps inline
functions.
* Try to get it done with using:
/* Somewhere in cmath */
namespace std {
using ::sin;
using ::cos;
...
}
Im not sure if this could work.
I don't know how far the current 2.95.2 issues with namespaces,
namespace std and using have been solved, that will have an influence on
my problem, too.
Any comments welcome. I'm not on the mailing list, so please CC me.
Bernd Strieder