[bind10-dev] suggested team call agenda
JINMEI Tatuya / 神明達哉
jinmei at isc.org
Tue Dec 11 22:12:06 UTC 2012
At Tue, 11 Dec 2012 12:00:52 +0000,
Francis Dupont <fdupont at isc.org> wrote:
> > Actually, I used:
> > if (pointer != shared_ptr<Type>()) {
> > in the test and it was pointed out in a review this can be shortened.
>
> => if the smart pointer has a boolean operator this is useless.
Yeah, in this discussion, we should at least distinguish the direct
use of pointer value as boolean like
Foo* foo;
if (foo) {
...
}
and the use of smart pointer objects in a boolean context via
(an implicit call to) boolean type conversion operator
shared_ptr<Foo> foo;
if (foo) { // this is actually "if (foo.convert_to_bool())"
...
}
I tried to explain the difference in
http://bind10.isc.org/ticket/2377#comment:19 but there still seems to
be some confusion.
Note that here I'm not talking about whether or not the first is a
bad/acceptable style. I'm simply pointing out that it doesn't
(necessarily) make sense to discuss the former style based on whether
the latter style is acceptable.
---
JINMEI, Tatuya
More information about the bind10-dev
mailing list