Is it possible to determine at compile time whether an implementation provides exact-width integer types? Sample code (wanted):
#include <stdint.h>
#if HAS_EXACT_WIDTH_INTEGER_TYPES
uint32_t i;
#else
/* handle the case */
#endif
Reason of the question: writing an adaptable code, which does not lead to compile time errors if an implementation does not provide exact-width integer types.
- For each type described herein that the implementation provides, 261)
<stdint.h>
shall declare that typedef name and define the associated macros. Conversely, for each type described herein that the implementation does not provide,<stdint.h>
shall not declare thattypedef
name nor shall it define the associated macros. An implementation shall provide those types described as ''required'', but need not provide any of the others (described as ''optional'').
i.e. uint32_t
exists iff #defined UINT32_MAX
, etc.