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

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Tue Dec 25 20:17:30 CET 2007


Hello,
On Tue, Dec 25, 2007 at 07:24:36PM +0100, Michael Niedermayer wrote:
> On Mon, Dec 24, 2007 at 11:39:30PM +0100, Reimar Döffinger wrote:
[...]
> > Firstly, this is not really my code so I mostly restrict myself to
> > things I expect no discussion about.
> > Secondly, at least to me, ! and == 0 have different semantic meanings.
> > E.g. I strongly dislike !strcmp(...) because IMO the use of ! maps
> > "intuitively" to an inequality, which is why I prefer strcmp(..) == 0.
> 
> hmm i dunno, IMHO ! makes more sense if you map it to no(t) 
> 
> if( ! strcmp() )
> "if no difference"
> 
> if( strcmp() == 0 )
> "if difference is zero"

Except two points:
1) the second "translation" IMO can stay closer to the code if you also
   consider the arguments:
  "if no difference between a and b"
  "if difference(a,b) is zero"
  problem is though that strcmp is not exactly "difference", which leads
  to
2) The strcmp -> difference "translation" is not obvious - it is
especially problematic if you can't restrict yourself to C but also work
with languages where the preferred way to compare is a isEqual function
or similar. If you worked with such a language for a longer time
immediately before, the == 0 immediately reminds me that strcmp works in
a different way.

> if(!ptr) exit()
> "if no (valid) pointer (then) exit"

I always read that as "if not ptr", because it makes somehow sense to me
as meaning 'the "object" ptr is not'.

> [...]
> > That said we all know we don't want "if (!(a == 0) == 1)" or similarly
> > funny things. 
> 
> of course not, everyone knows its
> if (!(a == '-'-'-') == '/'/'/')

Actually, it's none of those you really see. Those I really see are
usually of the way "if ((a == 0) == true)" - somehow Java magically
attracts redundancy (and not quite the good kind of redundancy).

Greetings,
Reimar Döffinger



More information about the MPlayer-cvslog mailing list