Title
Can a one-past-the-end pointer be invalidated by deleting an adjacent object?
Status
open
Section
6.7.5.5.3 [basic.stc.dynamic.deallocation]
Submitter
comp.std.c++

Created on 2005-07-08.00:00:00 last changed 228 months ago

Messages

Date: 2005-07-08.00:00:00

When an object is deleted, 6.7.5.5.3 [basic.stc.dynamic.deallocation] says that the deallocation “[renders] invalid all pointers referring to any part of the deallocated storage.” According to 6.8.4 [basic.compound] paragraph 3, a pointer whose address is one past the end of an array is considered to point to an unrelated object that happens to reside at that address. Does this need to be clarified to specify that the one-past-the-end pointer of an array is not invalidated by deleting the following object? (See also 7.6.2.9 [expr.delete] paragraph 4, which also mentions that the system deallocation function renders a pointer invalid.)

History
Date User Action Args
2005-07-08 00:00:00admincreate