I know most compilers allow both:
#include <stdio.h>
and
#include <cstdio>
But someone argued that <stdio.h>
is not actually C++ standard. Is that true?
stdio.h
is standard, but deprecated. Always prefer cstdio
in C++.
[n3290: C.3.1/1]:
For compatibility with the Standard C library, the C++ standard library provides the 18 C headers (D.5), but their use is deprecated in C++.
[n3290: D.5/3]:
[ Example: The header<cstdlib>
assuredly provides its declarations and definitions within the namespacestd
. It may also provide these names within the global namespace. The header<stdlib.h>
assuredly provides the same declarations and definitions within the global namespace, much as in the C Standard. It may also provide these names within the namespacestd
. —end example ]