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

svn_tristate_t Re: svn commit: r1033006 - /subversion/trunk/subversion/include/svn_types.h

From: Daniel Shahaf <d.s_at_daniel.shahaf.name>
Date: Wed, 10 Nov 2010 00:31:11 +0200

stefan2_at_apache.org wrote on Tue, Nov 09, 2010 at 15:07:48 -0000:
> /** Generic three-state property to represent an unknown value for values
> * that are just like booleans. The values have been set deliberately to
> - * make tristates mainly compatible with #svn_boolean_t.
> + * make tristates disjoint from #svn_boolean_t.
> *
> * @since New in 1.7. */
> typedef enum
> {
> - svn_tristate_false = FALSE,
> - svn_tristate_true = TRUE,
> + svn_tristate_false = 2,
> + svn_tristate_true,
> svn_tristate_unknown
> } svn_tristate_t;

I see us someday pcalloc()'ing one of these and forgetting to reset it
to the 'svn_tristate_unknown' value.

Could we make compilers catch that for us?

Or should we just assert that the value really is one of those three
values? Or even interpret any value (except svn_tristate_true and
svn_tristate_false) as "unknown"?
Received on 2010-11-09 23:34:21 CET

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