Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!wuarchive!usc!chaph.usc.edu!nunki.usc.edu!jeenglis From: jeenglis@nunki.usc.edu (Joe English) Newsgroups: comp.lang.c++ Subject: Re: lint++ -> really "AutoCodeReview" -- Ideas requested. Message-ID: <7002@chaph.usc.edu> Date: 12 Dec 89 17:56:18 GMT References: <5457.25845C8E@urchin.fidonet.org> Sender: news@chaph.usc.edu Reply-To: jeenglis@nunki.usc.edu (Joe English) Distribution: na Organization: University of Southern California, Los Angeles, CA Lines: 27 Roy.Browning@f506.n106.z1.fidonet.org (Roy Browning) writes: > > > ComIdent::~ComIdent() > > { > > if ( string ) > > delete[strlen(string)+1] string; > > } > I believe your problem is your destructor. From reading Lippman >you are deleting an array of pointers stored in "string" where "[x]" is the >number to "free()". From the source code I've seen all "delete" does is to >call "free()" and pass it a "char *". Telling "delete" there are "[X]" >pointers stored at location "string" should cause some VERY unusual problems >if I'm correct. Actually, delete[X] p; is used when p points at an array of X objects with destructors. It calls the destructor on each of the X objects but only passes "p" to free() (or the equivalent function.) Since 'char' doesn't have a destructor, the above code is equivalent to just 'delete string;' --Joe English jeenglis@nunki.usc.edu