|
From: Ioannis V. <iv...@em...> - 2003-07-12 00:06:55
|
Here is what I said in a similar discussion in Usenet, it may help: "Sandeep Grover" <sa...@ma...> wrote in message news:3F0...@ma...... > Hi, > > If I do another delete on an object which has been deleted earlier, = then > how is > the system expected to behave ? It will get angry. > Is it an unpredictable behavior ?? Yes it is undefined behaviour. It may die, it may continue living and = die later, it may truncate data, everything. --=20 Ioannis * Programming pages: http://www.noicys.freeurl.com * Alternative URL 1: http://run.to/noicys * Alternative URL 2: http://www.noicys.cjb.net -------------------------------------------------------------------------= --- ----------------------- "Sandeep Grover" <sa...@ma...> wrote in message news:3F0...@ma...... > > > > Sandeep Grover wrote: > > > > > If I do another delete on an object which has been deleted = earlier, then > > > how is the system expected to behave? > > > > > > Is it an unpredictable behavior ?? > > > > It's undefined, so in theory, yes; anything could happen. > > > > S > > Thanks ! > > So, if I have an array of pointers; more than one of the entries could point > to > the same chunk of memory (allocated using new). How do I ensure that I > end up deleting that entry only once. I dont want to use reference-counting > kind of thing in constructor. Use a vector of the objects you want, or a list if it suits better the problem, and not a built in array of pointers. --=20 Ioannis * Programming pages: http://www.noicys.freeurl.com * Alternative URL 1: http://run.to/noicys * Alternative URL 2: http://www.noicys.cjb.net |