bug-gmp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GMP C/C++ namespace conflict


From: Hans Aberg
Subject: Re: GMP C/C++ namespace conflict
Date: Thu, 26 Apr 2001 10:51:29 +0200

At 08:09 +1000 2001/04/26, Kevin Ryde wrote:
>Hans Aberg <address@hidden> writes:
>>
>> But gmp.h includes <stddef.h>, which under C++ should be replaced by
>> <cstdlib>.
>
>gmp.h is designed for use with a c or c++ compiler, if <stddef.h>
>doesn't work on some particular system we'd like to know.

Under C++, <stddef.h> is compatibility header. On my compiler, it contains

#include <cstddef>
#if defined(__cplusplus) && defined(_MSL_USING_NAMESPACE)
        using namespace std;
#endif

Thus, if the compiler can cope with namespaces (and by this time, I figure
all up-to-date C++ compilers can, as the standard has been out for few
years), stddef.h merely includes and adds "using namespace std".

Now, if one is using dedicated namespace programming, one does not want to
have this "using namespace std", and once it has appeared in the input,
there is no way to nullify its effect on names.

If one should follow this C++ standard library, then gmp.h could add "using
namespace std" (which happens because of the inclusion of the <stddef.h>
instead of the <cstdlib> header), but the header <gmp> that might be added
for use with C++ only should not add "using namespace std".

  Hans Aberg
                  * Email: Hans Aberg <mailto:address@hidden>
                  * Home Page: <http://www.matematik.su.se/~haberg/>
                  * AMS member listing: <http://www.ams.org/cml/>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]