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

Re: boolean issue with serf

From: Greg Stein <gstein_at_gmail.com>
Date: Thu, 16 Apr 2009 22:36:46 +0200

On Thu, Apr 16, 2009 at 21:46, Stefan Küng <tortoisesvn_at_gmail.com> wrote:
> C. Michael Pilato wrote:
>> Stefan Küng wrote:
>>> Hi,
>>>
>>> A user reported a strange problem that happens only with TSVN and serf,
>>> but not with the CL client.
>>> http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=1752435
>>>
>>> After some testing I found that TSVN passes a value of 32 as 'true' to
>>> svn_client_lock for the --force flag. This works ok when using neon, but
>>> fails when using serf. If I pass 1 instead of 32 then serf works too.
>>>
>>> Now while I can fix this easily in TSVN, I'm wondering if it's really
>>> required to pass 1 as svn_boolean_t values? Shouldn't all comparisons be
>>> done as !=0 instead of == 1 in C since it doesn't have a bool type?
>>
>> While I generally agree that for all intents and purposes, false == 0 and
>> true is anything else, we do provide the values TRUE and FALSE for use with
>> svn_boolean_t and it is not technically a contract violation to expect
>> exactly one of those two values to be provided by the caller.
>
> Hmm - according to wikipedia:
> http://en.wikipedia.org/wiki/Boolean_datatype
>
> "However, problems arise from the fact that any non-zero value
> represents true in C, while the value TRUE is represented by a specific
> value. So while in other languages, if (foo == TRUE) ... is merely
> redundant, in C, it is actually incorrect code."

svn_boolean_t is defined as one of {TRUE, FALSE}.

Pass one of those values. Wikipedia does not define our svn_boolean_t.

-g

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1754509
Received on 2009-04-16 22:37:05 CEST

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.