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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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   / \

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]