[XS] : "snprintf" portability options
2 direct replies — Read more / Contribute
|
by syphilis
on Sep 15, 2024 at 05:46
|
Hi,
In Cpanel-JSON-XS-4.38, the XS.xs file contains a few lines like:
snprintf (enc->cur, IVUV_MAXCHARS, "%" UVuf, uv)
which is fine on *nix systems but on Windows builds of perl, whenever IVSIZE is 8, it warns:
XS.xs:2449:66: warning: format '%u' expects argument of type 'unsigned
+ int', but argument 4 has type 'long long unsigned int' [-Wformat=]
I can fix that for those Windows perls by replacing the occurrence of "%" with "%llu" but I doubt the portability of that fix. (I guess I could also add separate renditions for #if defined(WIN32) && IVSIZE == 8 .... yuk.)
What's the best portable way of dealing with this ? ... and where are the options for this formatting style documented ?
I can never remember where it that documentation is, and I can never find it when I need it :-(
Cheers, Rob
|