On Fri, Aug 09, 2002 at 12:53:42AM -0400, Eric Buddington wrote:
> I propose that the CImage class be modified to do its reference
> counting implicitly.
I'm against such update for few reasons
> The reason for this is that the new/delete semantics of the current
> scheme are confusing, and it is not hard to leak memory by forgetting
> to Release(), or cause segfaults by deleting an object that was
> already Release()'d.
I think the library gives you warning message whenever you try to
delete object which is referenced more then once - this should be easily
visible.
> class DImage {
> protected:
> CImage * img;
> public:
> DImage () { img = new CImage (); }
> DImage (DImage const & foo) { foo.img->AddRef(); img = foo.img; }
> ~DImage () { img->Release() }
> Release () {}
> };
Nobody stops you to use such class externaly - after all it's OO design
- but for me it's one extra useless pointer dereference and it makes me
no problems to call Release for CImage class - and as I've said the broken
usage could be seen very easily.
--
.''`. Zdenek Kabelac kabi@{debian.org, users.sf.net, fi.muni.cz}
: :' : Debian GNU/Linux maintainer - www.debian.{org,cz}
`. `' Modern processors are the most advanced heating systems around.
`- www.tomshardware.com
_______________________________________________
Avifile mailing list
[EMAIL PROTECTED]
http://prak.org/mailman/listinfo/avifile