[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]


Brian May <bam@debian.org> writes:

> However, is there anyway to make this work on non-GNU systems?
> (the GNU info page says that these values are GNU specific; I can't
> even seem to find a documented way to determine if they have been
> defined or not).

<stdint.h> is in C99 (ISO/IEC 9899:1999).  To check whether it
exists, you could try to compile a test program that uses
it. (Autoconf can easily do that, but adding it to an existing
program is nontrivial.)  Alternatively, you could check the value
of __STDC_VERSION__; but then you wouldn't notice if some C89
implementation has added the header as an extension.

<stdint.h> defines the uint16_t, uint32_t, int16_t and int32_t
types only if the platform supports types that have the required
properties.  C99 does not guarantee that such types exist, but
the latest POSIX.1 (IEEE Std 1003.1-2001 and ISO/IEC 9945-1:2002)
does.  You can check their existence with #ifdef UINT16_MAX etc..
However, if the platform does not have any matching types,
then the program will probably be unable to run anyway, so I
don't know what good an explicit check would be.

Reply to: