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

Hugo Beauzée-Luyssen hugo at beauzee.fr
Fri Nov 28 11:24:48 CET 2014



> On 28 Nov 2014, at 11:19, Edward Wang <edward.c.wang at compdigitec.com> wrote:
> 
> 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.”

Indeed I missed this one. That’s a bug in MSVC C99 implementation, and I’ll open yet another ticket with them.

> 
> 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”.

That’s the part I used for this commit.

> 
> 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.


Indeed, the commit message is clearly wrong, and I agree with that. I still don’t think the commit itself is wrong though.
Would reverting this, and commiting the same patch with a different wording be agreeable?

Regards,

— 
Hugo Beauzée-Luyssen
hugo at beauzee.fr




More information about the vlc-devel mailing list