[FFmpeg-devel] [PATCH] Remove final semicolons from get_bits macros
Michael Niedermayer
michaelni
Sun Feb 21 04:18:04 CET 2010
On Sun, Feb 21, 2010 at 03:05:12AM +0000, M?ns Rullg?rd wrote:
> Michael Niedermayer <michaelni at gmx.at> writes:
>
> > On Sun, Feb 21, 2010 at 02:43:46AM +0000, M?ns Rullg?rd wrote:
> >> Michael Niedermayer <michaelni at gmx.at> writes:
> >>
> >> > On Sun, Feb 21, 2010 at 01:19:16AM +0000, M?ns Rullg?rd wrote:
> >> >> Mans Rullgard <mans at mansr.com> writes:
> >> >>
> >> >> > Some of the macros in get_bits.h include a final semicolon. This
> >> >> > removes them and adds semicolons as necessary where these macros
> >> >> > are invoked.
> >> >> >
> >> >> > Tested with all three readers.
> >> >> > ---
> >> >> > libavcodec/get_bits.h | 118 ++++++++++++++++++++++++------------------------
> >> >> > libavcodec/mjpegdec.c | 24 +++++-----
> >> >> > 2 files changed, 71 insertions(+), 71 deletions(-)
> >> >>
> >> >> ping
> >> >
> >> > I prefer them with the semicolons as they are
> >> > They are blocks of code not single statements
> >> > This of course is arguably a bikeshed issue but to me
> >> >
> >> > if(X)
> >> > MAKRO()
> >> >
> >> > reminds me that i forgot something
> >> > while
> >> >
> >> > if(X)
> >> > MAKRO();
> >> >
> >> > looks like a function call
> >> > and then someone will argue that we need
> >> > do{
> >> > }while(0)
> >>
> >> Which we should, dammit.
> >
> > i dont like red tape
> > it just makes markos behave like something that they are not
>
> It makes them both be and look like a single statement with respect to
> flow control. With or without builtin semicolons, naked
> multi-statement macros are dangerous if someone decides to write
>
> if (cond)
> macro();
>
> Debugging such mistakes makes me want to kill whoever wrote the
> macro. You wrote some of them...
FFmpeg developer kills another ffmpeg developer over a dispute of
semicolon placement.
>
> >> I've tripped over those bizarre semicolons of yours too many times.
> >
> > and at least i would be tripping over the alternative too many times
>
> Then tell me how the hell you manage to remember which
> function-call-like things should have a semicolon and which ones
> shouldn't.
hmm, i seem to just know it
maybe its related to having a return value, i didnt check all macros
though
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I have never wished to cater to the crowd; for what I know they do not
approve, and what they approve I do not know. -- Epicurus
-------------- 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/20100221/9d88d0b0/attachment.pgp>
More information about the ffmpeg-devel
mailing list