[MPlayer-cvslog] r25521 - trunk/libmpdemux/demux_ogg.c

The Wanderer inverseparadox at comcast.net
Mon Dec 24 23:17:11 CET 2007


Rich Felker wrote:

> On Mon, Dec 24, 2007 at 04:56:34PM +0100, reimar wrote:
> 
>>-	   *flags = ((pack->granulepos & iframemask) == 0);
>>+	   *flags = (pack->granulepos & iframemask) == 0;
> 
> C has the ! operator for a reason. It would make this code a lot more
>  readable. I would go so far as to say that any occurrance of "== 0"
> in C is bad style but this is among the most blatant offenses.

Sometimes, explicitly comparing against 0 is more readable than just
'if(x)' or 'if(!x); I haven't narrowed down specific patterns as to when
that is the case, but I've certainly noticed it. I suspect that it will
generally hold true when dealing with numbers rather than, as here, with
Boolean values.

In this case, I think using the ! operator would make the code more
readable than the current form, but not necessarily more so than the
previous form - for the simple reason that what it would do is make the
grouping easier to discern at a glance, a task previously accomplished
quite adequately by the parentheses which have now been removed.

-- 
       The Wanderer

Warning: Simply because I argue an issue does not mean I agree with any
side of it.

Secrecy is the beginning of tyranny.



More information about the MPlayer-cvslog mailing list