Why do both “std::printf” and “printf” compile when using <cstdio> rather than <stdio.h> in C++? [duplicate]
问题 This question already has answers here : When using C headers in C++, should we use functions from std:: or the global namespace? (8 answers) Closed last year . To my knowledge, headers of the form cxyz are identical to xyz.h with the only difference being that cxyz places all of the contents of xyz.h under the namespace std . Why is it that the following programs both compile on GCC 4.9 and clang 6.0? #include <cstdio> int main() { printf("Testing..."); return 0; } and the second program: