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

RE: [Patch] Make svn_tristate_t compatible with svn_boolean_t

From: Bert Huijben <bert_at_qqmail.nl>
Date: Thu, 4 Nov 2010 10:09:03 +0100

> -----Original Message-----
> From: Stefan Fuhrmann [mailto:stefanfuhrmann_at_alice-dsl.de]
> Sent: donderdag 4 november 2010 0:21
> To: Subversion Development
> Subject: [Patch] Make svn_tristate_t compatible with svn_boolean_t
> Hi there,
> after stumbling twice over this issue, I ran grep
> and found that the current usage of svn_tristate_t
> does not depend on the actual numerical values
> used for its states.
> Therefore, I propose to define svn_tristate_false
> equal to FALSE and svn_tristate_true equal to
> TRUE. That way, we can compare booleans with
> tristates and assign booleans to tristates. Without
> that, we need to write code like
> if ((get_some_bool() ? svn_tristate_true : svn_tristate_false) ==
> get_a_tristate())
> ...
> Also, the following will compile without warning but
> requires the patch to do what was intended:
> // FALSE becomes "unknown", TRUE becomes "false"
> svn_tristate_t my_tristate = get_some_bool();

What do you try to get as result here?

I'm not 100% sure if tests like (12 == 12) really always return the defined
value TRUE and we most likely have other functions that return just some !=
0 value as svn_boolean_t.

And what if TRUE happens to be defined as -1?
(In that case unknown and FALSE would have the same value)

I don't think this change makes it easier to use the trystate. You still
have to perform the checks yourself.

Received on 2010-11-04 10:09:47 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.