On 9/12/2017 8:22 PM, Liu Hao wrote:
> On 2017/9/13 0:15, Eli Zaretskii wrote:
>>> You'd need to disassemble (or at least check with nm) the
>>> object/function to find out if it's calling __mingw_printf or regular
>>> printf, seems like emacs is using %lld and %I64 in different places.
>>
>> %lld is used for intmax_t values, %I64d is used for 64-bit values.
>>
>> Are you saying that MinGW64 doesn't support both %lld and %I64d?  If
>> so, under which conditions is each one supported?
>>
> 
> `printf()` provided by MSVCRT recognizes only `%I64d`, while 
> `__mingw_printf()` provided by MinGW-w64, which takes over `printf()` 
> due to `__USE_MINGW_ANSI_STDIO`, recognizes only `%lld`.

> This isn't related to the version of GCC, but to the version of 
> MinGW-w64 you have.
> 
These two things are orthogonal. GCC analyzes format strings and issues
warnings when they don't look right. print*() implementation (MSVCRT (without
MINGW_ANSI_STDIO), mingw (with MINGW_ANSI_STDIO), gnulib (when you use it), or
any other libc or utility library) analyzes format strings and expands the
field specifiers, producing the output. These two operate independently.

GCC looks at function attributes to get the idea what kind of formats it is
supposed to support.
"format (gnu_*printf, ...)" attributes support GNU formats.
"format (ms_*printf, ...)" attributes support MS formats.
"format (*printf, ...)" attributes are read as "ms_print*" when compiling for
Windows, and are read as "gnu_print*" when compiling for GNU.
What "GNU" and "MS" formats actually *mean* here (i.e. which kinds of
specifiers are valid or invalid) depends entirely on GCC.

Independently, actual print*() function implementations might support MS format
specifiers, or GNU format specifiers, or a mix of both (although it's usually
one or the other, with a bit of extras for compatibility in newer versions).

-- 
O< ascii ribbon - stop html email! - http://arc.pasp.de/

Attachment: signature.asc
Description: OpenPGP digital signature

------------------------------------------------------------------------------
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