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

Pre-RFC: Format symbols for printing I32, U32

Thread Next
From:
Karl Williamson
Date:
February 11, 2022 02:34
Subject:
Pre-RFC: Format symbols for printing I32, U32
Message ID:
68de1cc9-1c60-8caa-1eae-1dce501868c7@khwilliamson.com
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


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About