[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
05 Oct 2001 11:47:09 -0700
Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Channel Islands)
Akim Demaille <address@hidden> writes:
> I'm especially interested in your checking the *order* in which the
> headers are being tested: who is more std than the other? stdint or
> inttypes? The choice below is based on what was done, but I suspect the
> converse is to be made.
Both headers are required by C99, so in that sense they're both equally
"standard." inttypes.h is specifically defined by C99 as including
stdint.h and then adding a bunch of other stuff (primarily macros for
However, inttypes.h is "older" in that it was in earlier drafts of the
standard, and therefore some systems like Solaris 2.6 that were following
drafts of the standard have only inttypes.h and not stdint.h.
Personally, I tended to always look for stdint.h first for the not
particularly important reason that stdint.h will probably be faster for
the C preprocessor to chew through because it does a more limited thing,
whereas inttypes.h on a C99 system defines a bunch more stuff (and also
pollutes more of the namespace, not that well-written programs should
If you have inttypes.h, there's probably no reason to include stdint.h,
but it should just hit the header guards and essentially be a compiler
no-op so it probably doesn't hurt anything.
The best micro-optimization would probably be to include stdint.h alone if
you have it, otherwise look for inttypes.h and include it if present. But
the amount of compile time actually saved probably isn't worth doing
anything particularly complicated.
Russ Allbery (address@hidden) <http://www.eyrie.org/~eagle/>