From my understanding C99 new types such as uint32_t, uint_fast64_t, uintmax_t etc. are defined in <stdint.h>. However, I noticed they're also defined in stdlib.h, and from gnu.org I found out that it is one of many headers checked, but in other websites only <stdint.h> is referenced.
If I use these types including only <stdlib.h>, which has them defined in my implementation, will my program be portable for other platforms or it could not work because in another computer they're only defined in <stdint.h>?
My guess is that if I compile the program for every architecture/OS from my computer there won't be any problems, but the compilation could fail from another one because in that particular implementation the new types are only defined in another header.
Yes, or
<inttypes.h>. Not really to "guarantee portability", but rather include<stdint.h>to use those types at all in any compiler at any time. Note thatuint32_tand allintN_ttypes are optional - they may (potentially...) not be available even after includingstdint.h.It could not work.
Yes.
The site you referenced is about build system configuration used to build GCC compiler itself, it's not related to what GCC is offering when compiling programs. GCC compiles only for twos complement platforms, you may be sure that
stdint.hwill be available when you are using GCC.