[Ffmpeg-devel] Re: [xine-devel] Suspicious code in xine-lib CVS from 2006-04-16 18:43
Måns Rullgård
mru
Tue May 30 00:25:41 CEST 2006
Gary Corcoran <gcorcoran at rcn.com> writes:
> 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.
A competent person will be able see what the intent was without
relying on comments.
--
M?ns Rullg?rd
mru at inprovide.com
More information about the ffmpeg-devel
mailing list