Home >Backend Development >C++ >Why does `printf` work in both `std::printf` and `printf` when using `` in C ?
cstdio Stdio.h Namespace
In the C reference documentation for
Answer
Including
This behavior extends to all C-style headers. According to the C 11 standard (Annex D), C standard library headers behave as follows:
"2 Every C header, each of which has a name of the form name.h, behaves as if each name placed in the standard library namespace by the corresponding cname header is placed within the global namespace scope."
Therefore, it remains uncertain whether these names are initially declared or defined within the namespace std and then injected into the global namespace via using-declarations, or vice versa.
The above is the detailed content of Why does `printf` work in both `std::printf` and `printf` when using `` in C ?. For more information, please follow other related articles on the PHP Chinese website!