|
From: | Remi Chateauneu |
Subject: | Re: [Mingw-cross-env-list] printf("%lld %jd" unknown conversion type character 'l' and 'j' in format |
Date: | Wed, 24 Apr 2013 22:05:45 +0100 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.9.2.12) Gecko/20101027 Lightning/1.0b2 Thunderbird/3.1.6 |
Thanks for the answer. Finally I decided to use the printf statement
PRId64 but still I am surprised by the default size of 32 bits for a
long long. http://stackoverflow.com/questions/330374/long-long-implementation-in-32-bit-machine "As per c99 standard, size of long long should be
minimum 64 bits."Isn't it rather that some sprintf format directives are missing because they are Linux-specific ? Cheers Remi Le 13.04.2013 07:54, Tony Theodore a écrit : 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=23004498As 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 |
[Prev in Thread] | Current Thread | [Next in Thread] |