Proposal for addition: tristate class - 3-state logical type
Kuba Ober
kuba at mareimbrium.org
Sat Sep 10 15:02:16 BST 2005
> > Simple yet readable bool type replacement when you need to return a
> > special "don't know" or "cancelled" state from your function and you
> > detest exceptions like me.
[...]
> That remind me an old thread
> http://lists.kde.org/?t=109689376400005&r=1&w=2
>
> My objections are still the same: it can be done with a simple int or an
> enum.
That's bad example C thinking when we in fact use C++. After some minor
tweaking it should perform at least as good as a bare int would. This really
has (or should have, when properly tuned) no overhead. The semantics might be
those of an int, but the syntax, and thus readability and maintainability are
important here. And how many times do you really want to write those
{ yes,no,null } enums?
Write-only code is never good, and that's what you get with 'but an int would
be just as good' mentality.
Cheers, Kuba
More information about the kde-core-devel
mailing list