Should `nullptr_t` be part of the global namespace?

I see that Microsoft stddef.hdefines it nullptr_tthis way:

namespace std
{
    typedef decltype(__nullptr) nullptr_t;
}

using ::std::nullptr_t;

Ad usingembeds nullptr_tin global namespace. I can not find anything in the standard that says this should be done.

I also see that GCC is nullptr_tnot part of the global namespace.

Is it possible to resolve both implementations or is one of them an error? My bad, GCC behaves just like CL.


Edit: The same thing happens with the cstddeffollowing compiles with VC ( on the Internet too ).

#include <cstddef>

int main()
{
    nullptr_t nil = nullptr;
}
+4
source share
2 answers

.

D.5 C [des.c.headers]

2 C, name.h, , , cname, . [...]

, ++. ++ <cstddef>, C <stddef.h> , ++ <stddef.h> .

+7

, GCC nullptr_t .

?

https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/ginclude/stddef.h;hb=HEAD#l436

GCC, GCC 4.8.0 .

cstddef,

. ::nullptr_t , <stddef.h>. std::nullptr_t , <cstddef>.

+2

Source: https://habr.com/ru/post/1611407/


All Articles