From: SourceForge.net <no...@so...> - 2009-07-09 12:34:36
|
Bugs item #2818436, was opened at 2009-07-08 09:50 Message generated for change (Settings changed) made by keithmarshall You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=102435&aid=2818436&group_id=2435 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: gcc >Group: Behaves as Documented >Status: Closed >Resolution: Invalid Priority: 5 Private: No Submitted By: Steven Van Ingelgem (g00fy) Assigned to: Nobody/Anonymous (nobody) Summary: GCC 4.4.0 "unknown conversion type character 'l' in format" Initial Comment: When compiling: #include <stdio.h> int main( int argc, char*argv[] ) { unsigned long long i; sscanf(argv[1], "%llu", &i); printf("%llu", i); return 0 } I get this warnings: C:\tmp>g++ tst.cpp tst.cpp: In function 'int main(int, char**)': tst.cpp:7: error: expected ';' before '}' token C:\tmp>g++ -Wall tst.cpp tst.cpp: In function 'int main(int, char**)': tst.cpp:4: warning: unknown conversion type character 'l' in format tst.cpp:4: warning: too many arguments for format tst.cpp:5: warning: unknown conversion type character 'l' in format tst.cpp:5: warning: too many arguments for format C:\tmp>a 16409049846434354 2738014770 C:\tmp> As you can see, it interprets the unsigned long long as a 32 integer, and not 64 bit one... Grtz, Steven ---------------------------------------------------------------------- >Comment By: Keith Marshall (keithmarshall) Date: 2009-07-09 12:34 Message: > 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). If you are using mingwrt-3.15 or later, it provides an alternative implementation of printf and friends, (but not scanf and friends), which does accept ISO-C99 format specifiers; however, for truly portable code, you should learn to use inttypes.h to formulate portable format specification strings. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=102435&aid=2818436&group_id=2435 |