RFC: A new helper class

Richard Dale Richard_Dale at tipitina.demon.co.uk
Mon Oct 4 19:56:39 BST 2004

On Monday 04 October 2004 19:37, Jarosław Staniek wrote:
> As Richard Dale mentioned, booleans are booleans. Unlike simple enum,
> tristate inherits everything from bool type, I mean: operators !, =, and
> implicity casts to (bool).
> Operator ~ is consistent addition, in my opinion. Thus even "! ~" working
> as "not cancelled" :)
> With tristate class you can forget about it's additional meaning and just
> treat it as a bool.
Surely you're disagreeing with me. Booleans have two states true and false - 
that's the definition of a boolean. You should never have to write code which 
depends on whether true is 1 or false is 0 (what is -1 I can never quite 
remember, and I've only been coding C since 1987?). C should have had a 
boolean type from the start, this business about an int with a value of 0 
being false, and anything else being true is just a design flaw. No need to 
reproduce that nonsense in a modern api.

-- Richard

More information about the kde-core-devel mailing list