develooper Front page | perl.perl5.porters | Postings from February 2022

Pre-RFC: Format symbols for printing I32, U32

Thread Next
Karl Williamson
February 11, 2022 02:34
Pre-RFC: Format symbols for printing I32, U32
Message ID:
Because the proper print formats for an IV and UV differ across 
platforms, we have things like
#define	IVdf		"ld"
so that an application doesn't have to worry about it.
But we don't have anything similar for I32 and U32, which also vary. 
Currently the portable way to format these is to cast them to IV or UV 
and use one of the ones we've defined for those.

But why not have U32df, I32Xf, etc so that the cast wouldn't be necessary?

I think it would be even better to have length modifiers for both cases, 
like we %hd already exists for a short value.  Formats using the IVdf 
are harder to read and type than a length modifier would be.

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About