Topic: should delete nullify the pointer (was: NULL "this" pointers)


Author: jthorn@galileo.thp.univie.ac.at (Jonathan Thornburg)
Date: 2000/10/05
Raw View
In article <39DB61F7.949E4622@tribble.com>,
David Tribble <david@tribble.com> nicely summarized the arguments in
favor of his proposal that   delete p;   should nullify p.

How would this proposal handle the case where p is a non-lvalue
expression?  For example,

 int *bar();
 int *p;
 bool cond;
 // ...
 delete cond ? p : bar();

Should  p  still be nullified if  cond == true ?

--
-- Jonathan Thornburg <jthorn@thp.univie.ac.at>
   http://www.thp.univie.ac.at/~jthorn/home.html
   Universitaet Wien (Vienna, Austria) / Institut fuer Theoretische Physik
   [[about C/C++ pointer casts]]
   "Casting should required the root password I believe at times.
                                    --  Ron Natalie in comp.std.c++

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]