[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r28752 - in branches/reintegrate/subversion: libsvn_fs_base tests/libsvn_fs

From: Branko Čibej <brane_at_xbc.nu>
Date: Mon, 07 Jan 2008 06:16:23 +0100

Daniel Rall wrote:
> On Sat, 05 Jan 2008, Branko Čibej wrote:
>
>
>> Daniel Rall wrote:
>>
>>> On Fri, 04 Jan 2008, cmpilato_at_tigris.org wrote:
>>> ...
>>>
>>>
>>>> + /* Are we changing the node? */
>>>> + if ((! has_mergeinfo) != (! *had_mergeinfo))
>>>>
>>>>
>>> ...
>>>
>>> I find this expression really difficult to grok at first glance. Is there
>>> a simpler way to do it (without all the negation)?
>>>
>>>
>> Not in C, since it doesn't have a real boolean type. This is a pretty
>> standard way of writing a logical exclusive-or.
>>
>
> Okay, thanks Brane.
>
> (And gross!)
>
Well ... It would seem obvious at first glance if C had grown ^^ along
with && and || during its evolution. But in fact != and ^^ would behave
identically on boolean values, and the only benefit of having ^^ would
be its conversion of !=0 to 1 ... which you can do with !! just as well.

Do you like all the punctuation? :)

-- Brane

P.S.: For a moment there I was going to recommend Python with its
keyword logical operators, but heh, Python doesn't have "xor" either. In
fact, from my experience the use of logical-exclusive-or in code is so
rare compared to its bitwise counterpart, it hardly seems necessary to
have a special operator.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-01-07 06:16:51 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.