mardi 30 juin 2015

Are C++ versions of C standard library functions in the std:: namespace? [duplicate]

"C++ Primer" (5th edition) states on page 91 the advantage of including the C++ version of a C standard library header instead of the .h version: this way the included names end up in the std:: namespace and do not pollute the global namespace.

I tried including cstdio and was surprised to observe that I can use printf() without specifying std::. Interestingly, including only iostream or only string is also sufficient to get access to a global printf(). Am I missing something?

I am compiling with g++ 4.8.2 with -Wall -Wextra -Werror -std=c++11.

Aucun commentaire:

Enregistrer un commentaire