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

Re: [PATCH] Fixed format specifier width mismatch


On Mon, 21 Dec 2015, Lukas Slebodnik wrote:
> On (20/12/15 16:29), Joseph Ates wrote:
> >+#  define LargestIntegralTypePrintfFormatDecimal "%I64u"
> character "%" is usually not part of format string macros
> 
> @see standard header file inttypes.h
> (or manual page)

The patch attempts to match the current format specifiers for the macro 
LargestIntegralTypePrintfFormat which cannot be represented without the 
"%" character on WIN32. For WIN32, LargestIntegralTypePrintfFormat is 
defined as:

#  define LargestIntegralTypePrintfFormat "0x%I64x"

However on other platforms it is defined as:

#  if __WORDSIZE == 64
#   define LargestIntegralTypePrintfFormat "%#lx"
#  else
#   define LargestIntegralTypePrintfFormat "%#llx"
#  endif

This seems inconsistent as the permanent "0x" prefix used on WIN32 
allows for representing zero values with a hexadecimal prefix (e.g. 
"0x0") but the "#" flag represents the zero without any prefix (e.g. 
"0").


References:
[PATCH] Fixed format specifier width mismatchJoseph Ates <joseph.ates@xxxxxxxxxxxxx>
Re: [PATCH] Fixed format specifier width mismatchLukas Slebodnik <lslebodn@xxxxxxxxxx>