[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Portable printing of 'size_t' (especially with mingw for windows)

From: Pádraig Brady
Subject: Re: Portable printing of 'size_t' (especially with mingw for windows)
Date: Thu, 11 Sep 2014 19:40:50 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2

On 09/11/2014 07:20 PM, Assaf Gordon wrote:
> On 09/11/2014 11:48 AM, Pádraig Brady wrote:
>>> I wonder if there's a definition in "inttypes.h" or similar that would be a 
>>> correct one to use,
>>> or if there's another portable way to compile it.
>> I've some notes on printing int values at:
>> http://www.pixelbeat.org/programming/gcc/int_types/
> That's a very informative example, thanks!
> For reference, below are the warnings that this example program gives with 
> mingw.

> ## 64bit mingw with special CFLAG, no warnings:
> $ x86_64-w64-mingw32-gcc -Wall -Wextra -D__USE_MINGW_ANSI_STDIO=1 int_types.c
> ## 64bit mingw
> $ x86_64-w64-mingw32-gcc -Wall -Wextra int_types.c
> int_types.c: In function 'main':
> int_types.c:38:12: warning: unknown conversion type character 'z' in format 
> [-Wformat]

Ah right. One needs _POSIX defined, not _ISOC99_SOURCE.
I've adjusted my example to explicitly define __USE_MINGW_ANSI_STDIO instead.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]