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

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

 



Hi,

On Tue, 20 Feb 2007, Simon 'corecode' Schubert wrote:

> 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.

There are no booleans in C.

Also, you just state that the construct is not common for _you_. It is 
really quite common in C. Why? Because it is a short way to say _exactly_ 
what you want. Like when you say "BTW" instead of "by the way". It is not 
only quicker to type, it is also quicker to read.

> Even after so many years of breathing C, I find "if (!strcmp(foo, bar))" 
> misleading, suggesting "not compare", which translates to "not equal".

No, in plain English "!strcmp("nothing", u)" translates to "nothing 
compares to u.

In mathematics, which is the basis of computer languages, "not compare" 
means something completely different yet: "a" does not compare to "b" 
means that they cannot be compared at all, i.e. the statement "a<b" is 
neither true nor false.

So, we have -- as so often -- a case, where somebody says "it is obvious 
how this expression translates to English", but really, it is not. So, why 
not stay in the context, and interpret it like millions of programmers 
before us? Or do you want to start another Babel?

Ciao,
Dscho

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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]