14 Dec
2001
14 Dec
'01
10:30 a.m.
Hello, The following is use by the boost shared_ptr assignment operators (see boost\smart_ptr.hpp)... void share(T* rpx, long* rpn) { if (pn != rpn) { // Q: why not px != rpx? A: fails when both == 0 ++*rpn; // done before dispose() in case rpn transitively // dependent on *this (bug reported by Ken Johnson) dispose(); px = rpx; pn = rpn; } } // share ...I curious to know what it means by "fails when both == 0". I mean, I can't see as the sky would fall in if the test was "if (px != rpx)". Am I missing something? Thanks, Louis.