[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Mingw-cross-env-list] printf("%lld %jd" unknown conversion type cha
From: |
Tony Theodore |
Subject: |
Re: [Mingw-cross-env-list] printf("%lld %jd" unknown conversion type character 'l' and 'j' in format |
Date: |
Sat, 13 Apr 2013 16:54:48 +1000 |
On 12/04/2013, at 10:32 AM, Remi Chateauneu <address@hidden> wrote:
> Hi,
>
> Still trying to compile and link fldigi with MXE, and I get the error with
> the following line:
>
> printf("%lld %jd", freq, (intmax_t)rtime );
>
> spot/pskrep.cxx:735:2: warning: unknown conversion type character 'l' in
> format [-Wformat]
> spot/pskrep.cxx:735:2: warning: unknown conversion type character 'j' in
> format [-Wformat]
>
> Some details about a similar problem here:
>
> http://sourceforge.net/mailarchive/message.php?msg_id=23004498
>
>>> As you can see, it interprets the unsigned long long as a 32 integer,
>>> and not 64 bit one...
>>
>> Which is exactly as you should expect, when you use the standard Microsoft
>> implementations of printf, scanf and friends, (as MinGW does).
>
> This leaves me a bit surprised because "long long" has to be 64 bits
> everywhere I think.
It's 32 bit by default:
$ printf "#include <stdio.h>\nint main(void) {unsigned long long
i;printf(\"%%lld\", i);return 0;}" | i686-pc-mingw32-gcc -x c - -Wformat
<stdin>: In function 'main':
<stdin>:2:1: warning: unknown conversion type character 'l' in format
[-Wformat=]
<stdin>:2:1: warning: too many arguments for format [-Wformat-extra-args]
but you can use the "-ansi" or "-posix" flags to trigger the 64 bit alternative:
$ printf "#include <stdio.h>\nint main(void) {unsigned long long
i;printf(\"%%lld\", i);return 0;}" | i686-pc-mingw32-gcc -x c - -Wformat -ansi
Cheers,
Tony