[vlc-devel] [vlc-commits] libmp4: Use a portable format specified for uintmax_t

Edward Wang edward.c.wang at compdigitec.com
Fri Nov 28 11:19:13 CET 2014


On Fri, Nov 28, 2014 at 2:03 AM, Hugo Beauzée-Luyssen <hugo at beauzee.fr> wrote:
>> > Any docu I find tells that PRIuMAX is exactly meant for uintmax_t.
>>
>> And... ?
>
> It makes the code non portable, specifically, visual studio ignores %ju,
> while it understands PRIuMAX properly.
> I fail to understand what's wrong with this commit, beside and eventual
> wording problem in the commit log.

7.19.6.1.7 states that

[j] "Specifies that a following d,i,o,u,x,or X conversion specifier
applies to an intmax_t or uintmax_t argument; or that a following 'n'
conversion specifier applies to a pointer to an intmax_t argument."

However 7.8.1 states that

"Each of the following object-like macros expands to a character
string literal containing a conversion specifier, possibly modified by
a length modifier, suitable for use within the format argument of a
formatted input/output function when converting the corresponding
integer type. "

where PRIuMAX is one of these "object-like macros".

Source: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf
(Working paper but includes C99 TC1 and TC2)

So since both of these methods are in the standard, then as long as
using PRIuMAX does not cause any undesired functional changes while
adding MSVC support, I'm not sure if there's anything objectionable
per se about using PRIuMAX.

And as already mentioned, probably the commit log could have been
better written to clarify MSVC's lack of %j support as the main
motivation.

Regards,
   Edward Wang



More information about the vlc-devel mailing list