On Fri, Jan 16, 2009 at 03:15:55PM +0700, Robert Elz wrote: | I'd suggest that every _t type defined (anywhere in the basic system | anyway) should have a PRI macro defined along with it (the sole exception | being types that it is impossible to print with any simple format - structs | and such). I think this idea has merit. | I've been meaning to suggest this as a policy for some time now - originally | I was planning on exempting the [u]intNN_t types, but even those I believe | should have PRI macros. | | After all, who can tell what format string is supposed to be used on | various different systems for a int32_t - it's probably %d on most | systems today, but on a 16 bit int system (and yes, I know, not supported | by NetBSD) it would need to be %ld, and perhaps more likely, if we ever | get a 64 bit int system, it might need to be %hd or something. PRId32 from <inttypes.h> already exists for int32_t, with variations for all of the [u]intNN_t sizes. These were introduced in C99; if you want these in C++ you need to define __STDC_FORMAT_MACROS before including the header. cheers, Luke.
Attachment:
pgp7L9kPHwN4C.pgp
Description: PGP signature