in reply to Re^3: [XS] : "snprintf" portability options
in thread [XS] : "snprintf" portability options
The warning is spurious, %I64u is valid on Windows. Unfortunately with the macro the full text of the format is hidden so all you have is the misleading "%u" from the base message:
C:\Users\Tony\dev\perl\git>gcc -Wformat -oint64.exe int64.c int64.c: In function 'main': int64.c:6:15: warning: format '%u' expects argument of type 'unsigned +int', but argument 2 has type 'long long unsigned int' [-Wformat=] 6 | printf("%I64u\n", x); | ~~~~^ ~ | | | | | long long unsigned int | unsigned int | %I64llu C:\Users\Tony\dev\perl\git>type int64.c #include <stdio.h> unsigned long long x = 0; int main() { printf("%I64u\n", x); }
If it is a bug, it's a bug in perl, since that's where the macro OP is using comes from.
I've considered changing the Win32 config in perl to use "%llu"/"%lld" instead, but testing against the older versions of MSVCRT in older Windows that we theoretically support is difficult.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: [XS] : "snprintf" portability options
by NERDVANA (Priest) on Sep 17, 2024 at 01:34 UTC | |
by tonyc (Hermit) on Sep 17, 2024 at 04:41 UTC | |
by syphilis (Archbishop) on Sep 17, 2024 at 07:49 UTC | |
|
Re^5: [XS] : "snprintf" portability options
by ikegami (Patriarch) on Sep 17, 2024 at 10:25 UTC |