|
Boost : |
From: Miki Jovanovic (miki_at_[hidden])
Date: 2000-03-06 11:37:44
First, I have to agree with the 'this is cool' comment. I am still
understanding the code, examining possible uses. But any way, the idea
has great potential. When I figure things out little more I might come
back with some constructive suggestions. But, thre is one thing I feel
quite strongly about...
dave abrahams <abraham-_at_[hidden]> wrote:
> Implicit conversion to bool is a terrifying idea, since bools can be
> promoted to any integer type.
I have to very, very, very agree with this one. Implicit cast means
that one object can actually be viewed as something else. If you want
to push this, you might end up saying, "pointer IS a bool". And this is
not true.
I further more think that writing:
if ( ptr ) {}
is evil. OK, not evil, but less readable then explicitly checking if
the pointer is NULL:
if ( ptr != NULL ) {}
But that is the point of coding style and I will not argue it. But what
I want to argue is that even though standard allows it, we should not
encourage it. If you on the other hand had an implicit conversion to a
pointer of sorts, and then used that pointer in the if statement, you
could still write it your way, but that would not encourage the
practice I feel is not nice.
Cheers,
Miki.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk