Hallo Shawn, Shawn O. Pearce schrieb am Mon 21. Apr, 19:59 (-0400): > Jrg Sommer <joerg@xxxxxxxxxxxx> wrote: > > Yes, you're right. I've checked some other functions and found this > > behaviour. Can I use a different behabiour, i.e. return 0 on failure and > > !0 on success? > > I wasn't objected to the return values as written, but more to the > fact that it seemed like a logic error to me. We use both patterns > in Git. Perhaps the best example to follow is get_sha1_hex(); > it returns -1 on error and 0 on success. So a common pattern is > "!get_sha1_hex()" to ensure a successful conversion of a hex string > to an unsigned char array. Thanks for this explanation. This was what I was looking for. Another question: Is :0 a valid mark? In import_marks() is a check for !mark, but I haven't seen it anywhere else. Bye, Jörg. -- Du hast keine Chance – also nutze sie.
Attachment:
signature.asc
Description: Digital signature http://en.wikipedia.org/wiki/OpenPGP