Nmap Development mailing list archives
Re: nmap 3.3+V-2.99
From: Brett Hutley <brett () hutley net>
Date: Mon, 01 Sep 2003 11:20:40 +1000
Jay Freeman (saurik) wrote:
Brett: Counted_ is defined to be a pointer. The only two expansions are: template <typename Counted_> class ReferenceManager : public NullReferenceHelper<Counted_ *> { public: // XXX: stupid gcc 3.2.2 typedef typename NullReferenceHelper<Counted_ *>::Value Value; This is a backend function of a massively generalized smart pointer class. The particular implementation of Clear being looked at is defined in a helper class that reference count managers that are managing pointers are encouraged to derive from for easier implementation. If you needed a smart pointer that worked over something else (maybe more smart pointers, maybe the windows HANDLE sysem, etc.) then you could implement your own version of Clear() that resets the value to a cleared state. In this case, simply setting it to NULL works. Your point about the callers being broken is what seems would have to be the case considering A) if it weren't something you could assign NULL to it wouldn't compile and B) assigning NULL to something that can be assigned NULL to wouldn't crash except if your reference to that object was invald and then reading the reference (such as Gisle's patch does) would also cause the same crash (well, unless the reference you have is in read only memory or something and also happens to be set to 0s, but I have hardly ever seen readonly memory used...).
Yes. I figured that Value was a smart pointer class, but rather than implementing with templates, I was assuming that it was implemented using a class with the assignment operator overloaded. That's why Gisle's patch looked so odd (at least with regard to the changes to the Clear() function.
-- Brett Hutley [MAppFin,CISSP,SANS GCIH] mailto:brett () hutley net http://hutley.net/brett ---------------------------------------------------------------------For help using this (nmap-dev) mailing list, send a blank email to nmap-dev-help () insecure org . List run by ezmlm-idx (www.ezmlm.org).
Current thread:
- nmap 3.3+V-2.99 Gisle Vanem (Aug 31)
- <Possible follow-ups>
- Re: nmap 3.3+V-2.99 Gisle Vanem (Aug 31)
- Re: nmap 3.3+V-2.99 Gisle Vanem (Aug 31)
- Re: nmap 3.3+V-2.99 Jay Freeman (saurik) (Aug 31)
- Re: nmap 3.3+V-2.99 Gisle Vanem (Aug 31)
- Re: nmap 3.3+V-2.99 Jay Freeman (saurik) (Aug 31)
- Re: nmap 3.3+V-2.99 Brett Hutley (Aug 31)
- Re: nmap 3.3+V-2.99 Jay Freeman (saurik) (Aug 31)
- Re: nmap 3.3+V-2.99 Brett Hutley (Aug 31)
- Re: nmap 3.3+V-2.99 Gisle Vanem (Aug 31)
- Re: nmap 3.3+V-2.99 Fyodor (Sep 04)
- Re: nmap 3.3+V-2.99 Gisle Vanem (Sep 04)
- Re: nmap 3.3+V-2.99 Jay Freeman (saurik) (Sep 04)