Web lists-archives.com

Re: [Mingw-users] snprintf and __USE_MINGW_ANSI_STDIO

> From: Keith Marshall <keithmarshall@xxxxxxxxxxxxxxxxxxxxx>
> Date: Wed, 16 Nov 2016 15:28:52 +0000
> 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.

I'm not sure it's GCC dumbness: it could be that the code in question
has some prototype that uses __attribute__ ((format (printf, ...))).

The solution is to use __attribute__ ((format (ms_printf, ...)))
instead; see the GCC manual for the details.  (Perhaps MinGW headers
should do that themselves?)

MinGW-users mailing list

This list observes the Etiquette found at 
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:
Also: mailto:mingw-users-request@xxxxxxxxxxxxxxxxxxxxx?subject=unsubscribe