Boost logo

Boost Users :

From: Serge Skorokhodov (serge.skorokhodov_at_[hidden])
Date: 2005-08-05 07:26:57


Hi,

>>>> 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: http://lists.boost.org/boost/2004/06/6499.php
>>
>> What was the reason not to implement this?
>>
>
> 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.

Still, why do not make it user configurable? Now I (and some
others of course:) have to write a wrapper to use tribool for my
purposes and (if undetermined were the default) somebody else
will need the same. I don't believe that it is possible to
satisfy everybody adding "null flavors".

-- 
Serge

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net