[FFmpeg-devel] [Patch] Fix for static leaks in h264.c
Michael Niedermayer
michaelni
Sun Jun 29 15:52:38 CEST 2008
On Sun, Jun 29, 2008 at 02:49:02PM +0100, M?ns Rullg?rd wrote:
> 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.
We where discussiing
{...}
vs
do{....}while(0);
not
...
vs.
do{....}while(0);
so i dont think your concernes apply here ...
>
> > 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 {}.
macros are NOT simple single statements.
Debugging a MAX(a++,b++) tends to nicely remind one of that, especially
when it was written lowercase and looking like a function.
IMHO if you want a function, write it as a function and not a macro.
>
> > 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
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel
>
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Republics decline into democracies and democracies degenerate into
despotisms. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080629/c54101e0/attachment.pgp>
More information about the ffmpeg-devel
mailing list