Thread (2 messages) 2 messages, 2 authors, 2016-08-11

Re: [PATCH] Documentation: Update information about <format> in git-for-each-ref

flat view

From: Junio C Hamano <hidden>
Date: 2016-08-11 19:43:22

Andreas Ericsson [off-list ref] writes:
Jakub Narebski wrote:
quoted
BTW. I had to translate
+       if (strcmp(who, "tagger") && strcmp(who, "committer"))
to
+       if (strcmp(who, "tagger") == 0 || strcmp(who, "committer") == 0)
to understand it. But this is probably my lack of contact with such
C idioms.
But this does the exact opposite....
"Compare" (as in "strcmp") also translates to "are equal to" and isn't
only a verb. This is unfortunate for people who aren't natively
english and has had me confused on many a long night...
Being a non-English speaker, I always pronounce xxxcmp() used as
boolean 'is different' in my head.  The (correct version of the)
above example expression is read as 'if it is different from
"tagger" and it is different from "committer", then do this'.

Otherwise I pronounce xxxcmp(a,b) "difference"; it's sign
matches (a-b).

if (xxxcmp(a,b) < 0) is similar to if ((a-b) < 0) which is
equivalent to if (a < b).
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help