Why do GCC/clang complain about including cstdint but not about stdint.h when compiling for C++98?
Compiling with -std=c++98 -x c++ -Wall -Wextra -pedantic outputs for #include <cstdint>:
This file requires compiler and library support for the ISO C++ 2011 standard.
According to the C++98 standard none of the headers are defined.
GCC
The
#includedirective is executed by the GNU C preprocessor (CPP) for C and C++ sources. The standard system directories for header files, searched at by default by CPP, contain the headers for the C Standard Library. For C++ additional directories are used for the search first. Thus even for C++ source the C Standard Library headers are available by default. The headerstdint.hfound is thus not the compatibility header available since C++11. But instead the C Standard Library header available since C99.I deduced this from an old version of the GNU CPP documentation:
See also the GNU CPP options
-nostdincand-nostdinc++.⚠ I assume this behavior is not backed by the C++ Standard.