[Ffmpeg-devel] [PATCH] from DivX, Part 7: MSVC fixes
Thu Jan 26 00:32:00 CET 2006
Rich Felker wrote:
> On Wed, Jan 25, 2006 at 10:09:17AM -1000, Steve Lhomme wrote:
>>>>> +#if __STDC_VERSION__ >= 199901L
>>>>> uint8_t fixed[s->mb_stride * s->mb_height];
>>>>> + uint8_t *fixed=(uint8_t*)alloca(s->mb_stride * s->mb_height);
>>>> #define A(type, name, size) type name[size];
>>>> #define A(type, name, size) type *name= alloca(size * sizeof(type));
>>>> would be cleaner but even then i would say that needs some disscussion and
>>>> should be a seperate patch
>>> This is a somewhat dangerous thing to do, since it makes sizeof(name)
>> I just checked, all the variables with this kind of change are never
>> used with sizeof().
> alloca is not portable. Moreover the 'portable' alloca dropin for
> systems missing it is implemented with malloc and evil garbage
> collection hacks meaning it will cause memleaks.
> C99 has vla's for a reason. It also lacks alloca for a reason. Don't
> use legacy nonportable crap in place of proper standards to work
> around MS's unwillingness to adhere to modern standards.
Hence the reason to only use alloca() for older compilers...
More information about the ffmpeg-devel