Boost logo

Boost Users :

From: Paul Johnson (gt54-boost_at_[hidden])
Date: 2005-08-05 05:34:25

Pavel Vozenilek wrote:
> "Douglas Gregor" wrote:
>>>Default initialization to 'false' seems to be quite unnatural in this
>>>context and initialization to 'undetermined' seems to be prefered. Is
>>>any significant reason for boost::logic::tribool default constructor
>>>initializing the value to 'false'?
>>Because default-constructing a bool gives a false value, and tribool
>>tries to mimick bool as well as possible.
> During review you agreed to make undeterminate as default value:
> What was the reason not to implement this?
> /Pavel

The OP actually wanted 'uninitialised' semantics. If tribool offered
uninit semantics, then yes, I agree that uninit should be the default.
However, 'uninitialised' isn't the same as 'unknown'. For example, for
'unknown' semantics, (false == unknown) should evaluate to unknown.
However, for 'uninitialised' semantics, (false == uninit) should
evaluate to false, because the left operand *has* been initialised.

I also want uninitialised semantics, so tribool isn't much use to me.

For 'unknown' semantics (ie. tribool), should the default be false,
true, or unknown? IMO, false.

My preference would be to see tribool extended to 4-value (at least)
logic (U,0,1,X), with U/uninitialsed as the default.

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at