I see this line from the c++ reference for cstdio:
Every element of the library is defined within the std namespace.
but I tried the code:
std::printf("hello world");
printf("hello world");
is it true that C++ headers puts the names in both the std and the global namespace?
Including
cstdioimports the symbol names instdnamespace and possibly in Global namespace.Including
stdio.himports the symbol names in Global namespace and possibly instdnamespace.The same applies for all c-styled headers.
Reference:
C++11 standard
Annex D (normative) Compatibility features [depr] states:
D.6 C standard library headers
Which include:
Further on,