[Ffmpeg-devel] Re: [xine-devel] Suspicious code in xine-lib CVS from 2006-04-16 18:43
Gary Corcoran
gcorcoran
Mon May 29 23:59:17 CEST 2006
M?ns Rullg?rd wrote:
>>> -----------------------------------------------------------------
>>> Cases from switch statements that fall through in some cases but
>>> do not have a fall through comment as in most such cases.
>>> ------------------------------------------------------------------
>> sorry but wtf is a fall through comment? on which page of the c standard
>> is that mentioned?
>
> They're talking about code like this:
>
> switch(foo){
> case 0:
> bar();
> case 1:
> baz();
> }
>
> Some people (presumably those who have difficulties understanding C
> code) insist that a comment mentioning the absence of a break
> statement just before a case label. These are the same kind of people
> that put comments like /* add 1 to i */ next to an i++ statement.
I disagree. A /*FALLTHROUGH*/ (or similar) comment, where one would
normally expect a break statement, lets a reviewer of the code _know_
that that is the intent of the writer. Otherwise he might just have
forgotten to add a break; (e.g. as a result of a bad copy-paste operation).
That is, it could well be unintended and thus a bug.
Gary
More information about the ffmpeg-devel
mailing list