2017-06-22 4:53 GMT+02:00  <sisyph...@optusnet.com.au>:
> -----Original Message----- From: Liu Hao
> Sent: Thursday, June 22, 2017 11:46 AM
> To: mingw-w64-public@lists.sourceforge.net
> Subject: Re: [Mingw-w64-public] how to printf() 64-bit integer in 64-bit
> compiler in strict ISO mode with all warnings enabled?
>
>>>   So, I need to printf() uint64_t in my project, which is built in strict
>>> ISO C11 mode and with all warnings enabled.
>>>
>>>   If I try to use "%llu" I get warning that "unknown conversion type
>>> character 'l' in format". If I use "%I64u" I get "ISO C does not support
>>> the 'I64' ms_printf length modifier" warning.
>>>   And, yes, I have _POSIX_C_SOURCE defined on compiler's command line.
>>
>>
>> In order to get C99 conforming `*printf()` functions you have to `#define
>> __USE_MINGW_ANSI_STDIO 1` before inclusion of any standard headers. One
>> preferable way to achieve that is adding `-D__USE_MINGW_ANSI_STDIO` into
>> your CPPFLAGS.
>
>
> This is what I invariably do, too.
>
> However, in a recent post to a gmp mailing list (
> https://gmplib.org/list-archives/gmp-bugs/2017-May/004162.html ), Keith
> Marshall discouraged this, warning that it was *not* guaranteed to continue
> to work into the future.
>
> Here's the relevant bit (from that post) of what he had to say:
>
> [--quote--]
>
> I would also point out that, as a "__USE_*" feature test, users should *not*
> define "__USE_MINGW_ANSI_STDIO" themselves; the correct way to enable it is
> to enable any of the "__STRICT_ANSI__" standards options, or to stipulate
> "_GNU_SOURCE", "_POSIX_C_SOURCE", or "_XOPEN_SOURCE" feature dependencies,
> (the latter two with an associated version stipulation), any of which will
> cause the MinGW runtime headers to enable "__USE_MINGW_ANSI_STDIO"
> implicitly.  You may get away with an explicit definition today, but I will
> offer no guarantee that a future MinGW Runtime release will not override any
> such definition, just as GNU's glibc headers do for their "__USE_*" feature
> tests.
>
> [--end quote--]
>
> AFAIK Keith's allegiance is with mpfr.org, and I don't know how/if those
> remarks relate to mingw-w64.

Well, we don't intend to remove our gnu-ish printf/scanf
implementation (C99) in near, or mid-term distance.
I agree that this feature needs to be used carefully, as it modifies
common Windows API expectations.
I don't see why this gnu-style-formatter routines are should be bould
to POSIX.  But I admit, it is a work-a-round for a portability issue.
As it is a C99 feature, STRICT_ANSI looks to me wrong too. For
_GNU_SOURCE we could consider that too.

> Any thoughts on that ?
>
> Cheers,
> Rob

Regards,
Kai

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to