fre 2006-02-24 klockan 18:21 -0700 skrev Duane Wessels: > Because I think its annoying to have to write > > if (foo) { > foo->unlock(); > foo = NULL; > } > > in so many places.
Indeed. > I started down that path and wasted about 4 days on it. Switching > from normal pointers to ::Pointer is not pleasant for something > that is used so pervasively. Not sure I see the problem. The typing overhead in the source should be the same as in the macro approach, except that it can be automated a bit more.. But in this light the macro change if expanding to something like the above is in fact a step forward, unifying the code and making the refcount transition easier. In fact this reminds me of the cbdata macros.. pointer = cbdataReference(original_pointer); cbdataReferenceDone(pointer); where cbdataReferenceDone is essentially the if block quoted above, plus some cosmetics for debugging purposes. Regards Henrik
signature.asc
Description: Detta är en digitalt signerad meddelandedel