Topic: Destructing pointers


Author: Roman Lechtchinsky <wolfro@cs.tu-berlin.de>
Date: 1997/03/28
Raw View
Hi,

the CD2 says that "the value of a pointer that refers to deallocated
storage is indeterminate". AFAIK this means that any use of the
pointer's value results in undefined behaviour. Now, 5.2.4 [expr.pseudo]
describes the syntax used to call destructors on objects of scalar type
and says: "The only effect is the evaluation of the postfix expression
before the dot or arrow". Does this mean that explicitly calling a
destructor on a deleted pointer using the dot notation like in the
example below results in undefined behaviour?

typedef int *I;
I p = new int;
delete p;
p.I::~I();


Bye

Roman
---
[ 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         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]