[FFmpeg-devel] [PATCH] configure: Enable MinGW-w64's implementation of vsnprintf and pals

Derek Buitenhuis derek.buitenhuis at gmail.com
Fri May 24 22:45:05 CEST 2013


On 2013-05-24 3:37 AM, Reimar Döffinger wrote:
>> We do use %zu, and (certain) people seem dead set against removing its
>> use, since it is the "most correct" thing to use for size_t prints.
> 
> Is that still the case? Because I find it very hard to argue that broken code would be "most correct".
> In addition using some macro would still allow using zu on Linux.

It is the case. It's arguable since %zu (and %Iu with MSVC) is the
correct way to print a variable of type size_t in C99, according to
the spec. Both host tools, and target code use %zu currently. (It
doesn't help that we have no real host feature detection system.)

This patch is semi-related, but never pushed (due to Libav folks
wanting to write a real host feature detection system):

http://ffmpeg.org/pipermail/ffmpeg-devel/2013-January/137460.html

>> As it stands MSVC and old MinGW are the only platforms which do not
>> have
>> a proper vsnprintf implementation. Also, our implementation is very
>> Windows-specific -- it won't work on anything else, and it's silly to
>> use it anywhere else. Thirdly, the usual "system implementations are
>> likely more optimzied" argument.
> 
> I very much hope performance isn't relevant, otherwise using printf is a mistake in the first place.

Yeah I know. That's why I put it in quotes.

>> IMHO, the "most correct" thing to do is only provide it for platforms
>> that
>> need it. You don't see us providing llrint() on platforms that have it,
>> do
>> you?
> 
> I know of no issues where the platform or our re-implementation requires special care in how we use it.

This may or may not be due to the very strong flaming that
went along with adding MSVC compatibility. ("Don't you DARE
ruin our lovely codebase for the sake of MSVC!" -- Double
Standards)

> It just seems to me that special-casing newer mingw is additional effort that at best hides bugs in our code that still will affect some users.

What "bugs"? Using C99 is a bug now? Also, it will only affect
people using a certain range of MinGW-w64 SVN trunk. No actual
release is affected. I don't consider this an issue.

> And how easy will it be to find out which printf variant was used by the ffmpeg some user used in a bug report?

As easy as "please attach your config.log".

> I admit I argued far longer than I care about it (and Windows in general), but my gut tells me it's a rather bad idea.

I wouldn't call it arguing, as much as healthy debate. :)

- Derek


More information about the ffmpeg-devel mailing list