On 4/11/2012 18:10, Mike Hommey wrote:
> Hi,
> 
> I recently downloaded mingw-w64-gcc-4.6.3-runtime-2.0.1-static-ada-20120321.7z
> and when compiling some things with it, I end up with unexpected warnings for
> format strings. The problem can be reproduced with the following:
> 
> ---->8-----
> #include <stdio.h>
> int main() {
>   size_t a = 1;
>   printf("%llu %llu\n", a, sizeof(a));
>   return 0;
> }
> -----8<----
> 
> $ x86_64-w64-mingw32-gcc -o test test.c -Wall
> test.c: In function 'main':
> test.c:4:1: warning: unknown conversion type character 'l' in format 
> [-Wformat]
> test.c:4:1: warning: unknown conversion type character 'l' in format 
> [-Wformat]
> test.c:4:1: warning: too many arguments for format [-Wformat-extra-args]
> 
> 
> The resulting binary however works just fine.
> 
> Sure, I could use %Iu, but it's less portable: with %llu, I only have to care
> about 32 vs 64 bits size_t...
> 

Use %I64u on Windows, or just use inttypes.h PRIuMAX.

If you must use %llu, define __USE_MINGW_ANSI_STDIO macro before
including stdio.h. Be aware that if you do this, MS type %I64* format
will no longer work.

Attachment: signature.asc
Description: OpenPGP digital signature

------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to