Subject: Re: [PATCH] Change "refs/" references to symbolic constants

From: Simon 'corecode' Schubert <[email-masked]>
Date: Tue, 20 Feb 2007 13:24:51 +0100

Johannes Schindelin wrote:
>> I've never really liked "!" on strcmp() lines (but I accept that that is the 
>> tradition in git) because it implies the the output of prefixcmp is boolean, 
>> but it's actually ternary.
> 
> Actually, it's not even ternary, but to the return value should only be 
> handled in terms of >0, ==0, <0.
> 
> Ah, and if "!" implies a boolean, then why is "!!" a common construct? 
> Because "!" really does not imply a boolean.

Depends on how you look at it.  I code using semantics which use expressions only as boolean if they are really are.  So NULL pointers are not treated like a boolean, and neither are errno nor strcmp.  For me that's part of good, readable style, but people/groups of course are free to disagree.  Even after so many years of breathing C, I find   "if (!strcmp(foo, bar))" misleading, suggesting "not compare", which translates to "not equal".  Of course I know it, and can work with it, but in my own code I'd never write this.  I don't see any gain except some obfuscation.

cheers
  simon

-- 
Serve - BSD     +++  RENT this banner advert  +++    ASCII Ribbon   /"\
Work - Mac      +++  space for low €€€ NOW!1  +++      Campaign     \ /
Party Enjoy Relax   |   http://dragonflybsd.org      Against  HTML   \
Dude 2c 2 the max   !   http://golden-apple.biz       Mail + News   / \