[FFmpeg-devel] [PATCH] replace %td by more standard %zd

Reimar Döffinger Reimar.Doeffinger
Wed Sep 30 15:55:41 CEST 2009


On Wed, Sep 30, 2009 at 04:52:17PM +0300, Uoti Urpala wrote:
> On Wed, 2009-09-30 at 15:17 +0200, Reimar D?ffinger wrote:
> > personally I am more in favour of casting to int and using %i, but at
> > least %zd is better supported it seems (e.g. Haiku compiler).
> 
> > -            av_log(avctx, AV_LOG_DEBUG, "%3X at %td left %d\n", start_code, buf_ptr-buf, input_size);
> > +            av_log(avctx, AV_LOG_DEBUG, "%3X at %zd left %d\n", start_code, buf_ptr-buf, input_size);
> 
> %td is completely standard, so %zd cannot be any "more standard". The
> result of pointer subtraction has type ptrdiff_t so %td is the most
> correct one to use here. If some platform fails to handle such standard
> printf features correctly isn't that a libc bug, not a compiler one
> (unless the compiler inlines printf calls - and that can't really happen
> here because of the indirection through av_log)?

Well, let me expand my statement: "e.g. the Haiku compiler warns about
it". And "more standard" meaning "used and implemented more frequently".
And I already said I'd prefer to just cast it to int and use %d - all of
course as an alternative to just ignoring it.



More information about the ffmpeg-devel mailing list