[Bug c/448] <stdint.h>-related issues (C99 issues)

geoffk at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Thu Aug 19 22:12:00 GMT 2004


------- Additional Comments From geoffk at gcc dot gnu dot org  2004-08-19 22:12 -------
My suggestion on how to implement this is to have stdint.h essentially contain a single line,

#pragma GNUC stdint

which defines the typedefs based on information in the machine description.  That information doesn't 
exist yet, so you'd have to add it, with suitable defaults computed from the sizes of the types (perhaps 
using the same algorithm that __attribute__((mode)) uses.  The information has to match the system's 
idea from inttypes.h, including such details as 'long' vs. 'int' even if they are both the same size.

On some systems, the same types can be defined in other headers, so the #pragma would need to only 
define a particular type if it hasn't been defined already.

You could theoretically do this with a huge collection of preprocessor macros, like stddef.h or limits.h, 
but this would be pretty painful, so don't.

A good testcase is to use -Wall and check that all the PRI* and SCN* macros from inttypes.h don't 
produce warnings when used in scanf and printf with the correct type.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=448



More information about the Gcc-bugs mailing list