[PATCH] long long for printf on MinGW

Daniel Jacobowitz drow@false.org
Wed Oct 11 13:03:00 GMT 2006


On Wed, Oct 11, 2006 at 11:57:49AM +0100, Andrew STUBBS wrote:
> Hi,
> 
> Windows/MinGW printf does support printing of long long types, but it 
> does not do using %lld etc.
> 
> This patch converts %ll (or %...ll) to %I64 as required by Windows.
> 
> GDB printf still won't accept I64 as input, but then this is not 
> standard compliant so I don't think it really should.
> 
> :ADDPATCH printcmd.c:
> 
> Andrew Stubbs

I don't much like #ifdef __MINGW32__, but I'm not sure what else to do
about it... I suppose we could autoconf for inttypes.h and check for
PRIx64 starting with 'I', but that's no better.

Could you at least do something like this?

#if defined(__MINGW32__)
# define USE_PRINTF_I64 1
# define PRINTF_HAS_LONG_LONG
#else
# define USE_PRINTF_I64 0
#endif

    if (lcount > 1 && USE_PRINTF_I64)

The GCC folks learned a hard lesson that conditionally compiled code is
a maintenance burden all its own.

Thanks in advance.

-- 
Daniel Jacobowitz
CodeSourcery



More information about the Gdb-patches mailing list