Namespace question

Jonathan Wakely
Thu Mar 9 14:29:00 GMT 2017

On 9 March 2017 at 03:19, Jonathan Wakely wrote:
> On 9 March 2017 at 02:49, Gabriel F. T. Gomes wrote:
>> Hi,
>> While working on a refactoring in glibc's libm, I came across a
>> question about namespace for some helper functions in math.h.
>> Each classification macro in math.h, has a type-specific helper
>> function, for instance __fpclassifyf for float.  We would like to
>> understand if these functions need to be in a namespace or if, since
>> they are helper functions, the namespace requirement does not apply.
>> For instance, is the namespace code in the examples below correct,
>> required, or even incorrect?
>> namespace __c99 {
>> extern int __fpclassifyf (float __value);
>> extern int __signbit (double __value);
>> extern int __isinff (float __value);
>> }
>> namespace std {
>> extern int __isinf (double __value);
>> }
> Libstdc++ doesn't use any of these functions. You can use whatever
> private namespaces you want for internal glibc functions.
> I would recommend against adding any non-standard functions to
> namespace std in the C library headers. The C++ library owns that
> namespace and littering it with non-standard names defined outside the
> C++ library doesn't seem wise.

N.B. libstdc++ removed the last mention of _GLIBCXX_USE_NAMESPACES in
2000, so we don't really care what glibc does with namespaces. We
don't use them.

More information about the Libstdc++ mailing list