[FFmpeg-devel] [PATCH] configure: remove -Werror=vla

Derek Buitenhuis derek.buitenhuis at gmail.com
Wed Apr 7 19:49:17 EEST 2021


On 07/04/2021 16:34, Nicolas George wrote:
> To answer that, I need to know why you think VLAs are considered bad
> practice.
> 
> VLAs on the stack are a bad practice because (1) they may use too much
> of the stack in an unexpected way, and (2) they require extra registers
> that ruin optimization in the whole function.
> 
> Obviously, it does not apply to pointers to VLA.

A few things:

1. I don't see the extremely minor (IMO entirely supeficial) benefit
   to using pointers-to-VLAs (presumably via av_malloc) to be worth
   it for disabling the Werror. Is there even a good argument for
   using them that isn't superficial?
2. It makes more inconsistent code in the codebase, if some use normal
   allocs, and some are accessed via pointer-to-VLAs. What's the benefit?
3. VLAs are optional in C11, and we use some C11 stuff in a few places if
   we can - which would make this perhaps mutually incompatible.
4. MSVC does not support VLAs, but supports the rest of C99, last I checked
   and this would effective remove support for it. You would be surprised how
   many users (large ones) use MSVC for FFmpeg.

I just don't really see the benefits being worth it, but I can see opinions
differ.

- Derek


More information about the ffmpeg-devel mailing list