Web lists-archives.com

Re: [Mingw-users] snprintf and __USE_MINGW_ANSI_STDIO




-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 16/11/16 13:50, Burkhardt, Glenn B        UTAS wrote:
> It looks like "snprintf" and friends don't have the same
> definitions to use the ANSI stdio functions like printf, fprintf,
> and sprintf do. The result is that if __USE_MINGW_ANSI_STDIO is
> defined, and -Wall is used, there are compile time warnings if
> specifications like "%lld" are used.

This is nothing whatsoever to do with __USE_MINGW_ANSI_STDIO, (which you
really SHOULDN'T define yourself, BTW; use appropriate _POSIX_C_SOURCE,
or _XOPEN_SOURCE definitions instead).  This is just evidence of the
inherent dumbness of GCC's printf format warnings.

> The function actually works correctly with "%lld". Is this a bug,
> or am I missing something?

If the function works correctly, it's hardly a bug, is it?  GCC's printf
format warning feature is unlikely to deliver sane diagnostics, while it
assumes that only MSVC semantics are applicable.  (FWIW, the second most
prevalent diagnostic emitted during a build of GCC itself, is a swathe
of bogus warnings about MSVC format specifiers).

If they bother you, disable the -Wformat (-Wno-format) messages, (or,
maybe better, use the format specifier macros from <inttypes.h>).

- -- 
Regards,
Keith.

Public key available from keys.gnupg.net
Key fingerprint: C19E C018 1547 DE50 E1D4 8F53 C0AD 36C6 347E 5A3F
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.20 (GNU/Linux)

iQIcBAEBAgAGBQJYLHszAAoJEMCtNsY0flo/ikkP/RQEvIFCaQdSg0Ne5sxuufSu
Ar41AjaO4BjlKlvVrR3Wu7Whox8QSZ6aZ7EpBSRwKQXMgdFuuLpD+oH1N/lo25Fs
bzZVDcHnPOGs+gtjD8VecfJrCc2W0CztuUZRaeVeyC8IZCcKU/8YsgQ52THOfdAG
GQzKTHEmk1SsFRI7mpWiQa51ngMXK/P2zoTjLgreRk+3xv3XVBi5K1H9n453pnVL
i9L6w7QD2HSbMvqAqqkLSHbsSGXL3grEjY8ZgOEwHyoj++T1nJwR9F1eT3OSELMJ
1Hz7+nRUBPY0IKW5LGzi+SsGnAUC5MbHTS0PD1RXORkxkap7pyJeQVXpdmSvgcBY
NDrpSlja9d47whnOQhXeWT5pT3uqmjm53ZM1SNquCP28ky/+1ghhvleSP3dP56xE
NnQTTozQUCr/E2LDpOQ5NwrFfqCmHLYPAwqicre92063CqRktel2KMEAKOAvSmtk
N4n4Wuoccq2zSC6A6yuEFv2sGZ1dIGY1OQBKOOUqQfX20JW2LToJbQ1GfFAIfCyp
ZRiSwbBdZlz84lKHawXz2noyB3DwZYOcVP0w6uDgmFj4dAW3tlPyo+OL5kSESYxt
KFBwipiMx+MrSbBH5crAezopoHkgbXt0xcggjysm/gtOOR1HGJturyw66JXvbgfL
YhvOQGYg3ITnukk2iI/f
=QE71
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx

This list observes the Etiquette found at 
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:mingw-users-request@xxxxxxxxxxxxxxxxxxxxx?subject=unsubscribe