tech-userlevel archive

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

Re: Defining more PRIxxx macros



On Sun, 18 Jan 2009, David Holland wrote:
> On Sat, Jan 17, 2009 at 10:53:08AM +0200, Alan Barrett 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 am very pleased to see support for this idea.
> 
> I still think this scheme is irredeemably ugly, but I don't really
> have any better ideas.
> 
> Although I think just casting the value arguments to large-enough
> integer types is a lot less error-prone.

Yes, it's terribly ugly, but I also don't have any better ideas.

Casting to [u]intmax_t and printing with %jd or %ju also works, but I
am not sure whether it's more or less ugly.  Casting to [u]intmax_t and
printing with PRIdMAX or PIRuMAX is more ugly.

--apb (Alan Barrett)


Home | Main Index | Thread Index | Old Index