[FFmpeg-devel] [Patch] Fix for static leaks in h264.c
Måns Rullgård
mans
Sun Jun 29 15:49:02 CEST 2008
Michael Niedermayer <michaelni at gmx.at> writes:
> On Sun, Jun 29, 2008 at 01:34:19PM +0100, M?ns Rullg?rd wrote:
>> Michael Niedermayer <michaelni at gmx.at> writes:
>>
>> > Iam fine with the patch in principle but not the do/while(). I do not like
>> > do-whiled macros.
>>
>> Why not? They are usually considered a Good Thing (tm).
>
> Yes i know, i just find them ugly and think thei uglyness outweights their
> advatages.
>
> if()
> MACRO();
> else
> ...
>
> would fail without the do/while
>
> while
> if(){
> MACRO();
> }else
>
> would work
>
> Maybe its just me but, i feel that the idea that any macro should behave
> exactly like a function is the problem ...
Have you ever had to debug a bizarre problem that turned out to be
caused by misbehaving macros in code you didn't write? If there's an
else, you at least get a compilation error. If the macro consists of
several naked statements, and there is no else, you get very
interesting results.
> Of course for macros which do look like functions i agree that the do/while
> should be added, but anything written in all upper case does not look like
> a function.
Function or not, the way it is used, it looks like a single
*statement*, and should behave like one. It's a very simple way to
avoid hard to find bugs, especially since you encourage if statements
without {}.
> All just IMHO, iam not strongly objecting do/while if more people want
> them than not.
I'll keep using it in code I write.
--
M?ns Rullg?rd
mans at mansr.com
More information about the ffmpeg-devel
mailing list