Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!ucsd!ucbvax!agate!shelby!neon!pescadero.Stanford.EDU!philip From: philip@pescadero.Stanford.EDU (Philip Machanick) Newsgroups: comp.lang.c++ Subject: Re: Curious about operator delete setting ptrs to zero... Message-ID: <1991Jan8.192903.19356@Neon.Stanford.EDU> Date: 8 Jan 91 19:29:03 GMT References: <546@taumet.com> Sender: news@Neon.Stanford.EDU (USENET News System) Reply-To: philip@pescadero.stanford.edu Organization: Computer Science Department, Stanford University Lines: 20 In article <546@taumet.com>, steve@taumet.com (Stephen Clamage) writes: |> warsaw@nlm.nih.gov (Barry A. Warsaw) writes: |> |> >Having been bitten lately with multiple destruction of freestore |> >allocated objects, I'm curious as to why operator delete does not, by |> >default, set the pointer whose object is being deleted to zero? |> |> Operator delete setting the pointer to zero is allowed but not |> required. (E&S says the value of the pointer is undefined.) |> Setting it to zero solves only part of the problem, however, since |> there may be other pointers in the program pointing to the now-deleted |> object. |> [...] How is it possible for operator delete to set the value of the pointer, since it is meant to be passed as void*? (You can't pass it as a reference to void*.) Am I missing something? -- Philip Machanick philip@pescadero.stanford.edu