[Ffmpeg-devel] [PATCH] move utf8 writing to libavutil

Michael Niedermayer michaelni
Sun Jul 9 05:11:11 CEST 2006


Hi

On Sat, Jul 08, 2006 at 10:04:06PM +0100, M?ns Rullg?rd wrote:
> Michael Niedermayer <michaelni at gmx.at> writes:
> 
> > Hi
> >
> > On Sat, Jul 08, 2006 at 08:56:18PM +0100, M?ns Rullg?rd wrote:
> >> Justin Ruggles <jruggle at earthlink.net> writes:
> >> 
> >> > Please explain the benefit of the do/while. What does it protect against?
> >> 
> >> Without it,
> >> 
> >> if(whatever)
> >>     PUT_UTF8(...);
> >> 
> >> will have some quite unintended results without so much as a warning.
> >> 
> >> The idea with a do { } while(0) construct is to turn the entire macro
> >> body into a single statement while still keeping the semicolon
> >> (usually) placed after the macro invocation part of this same
> >> statement.  Simply enclosing the body in braces will make the final
> >> semicolon form a new, empty statement, which will break things like
> >> 
> >> if(foo)
> >>     PUT_UTF8(...);
> >> else
> >>     PUT_UTF8(...);
> >
> > the intended use of thet GET/PUT_UTF8 macros was so that each application
> > could easily build their own utf8 reading and writing functions with their
> > own get_bits / put_bits system
> 
> That may well be, but I still think multi-statement macros should have
> a do { } while(0) just in case.  It can avoid some nasty and hard to
> find errors, and it has no negative effects.

i didnt object to their addition ... ( i just think they are ugly ...)

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is




More information about the ffmpeg-devel mailing list