Thread View: comp.std.c++
1 messages
1 total messages
Started by joe (j.) halpin
Fri, 22 Mar 1996 02:02
Re: Referencing pointers after delete
Author: joe (j.) halpin
Date: Fri, 22 Mar 1996 02:02
Date: Fri, 22 Mar 1996 02:02
49 lines
2358 bytes
2358 bytes
In article <4isca2$t20@news.BelWue.DE>, Dietmar Kuehl <dietmar.kuehl@uni-konstanz.de> wrote: >Hi, > >joe (j.) halpin (jhalpin@bnr.ca) wrote: >: In 3.7.3.2.4 the January working paper says: > >: 4 A deallocation function can free the storage referenced by the pointer >: given as its argument and renders the pointer invalid. The storage >: can be made available for further allocation. An invalid pointer con- >: tains an unusable value: it cannot even be used in an expression. > >: This sounds as though, in the following: > >: char *pc = new char[128]; >: delete pc; >: pc = 0; > >: it makes the final assignment (an expression) invalid. > >No. You cannot use the value of the pointer but you can use the pointer So, in the sentence above - "An invalid pointer contains an unusable value: it cannot even be used in an expression." - the word 'it' refers to the value and not the pointer? That makes sense, although the phrasing is a bit ambiguous. >(actually, you get undefined behavior in the code above because you >delete an array object with 'delete' instead of 'delete[]'; I assume Mea culpa. [...] Thanks Joe -- Joe Halpin jhalpin@nortel.com Nortel Wireless (214) 684-5657 Richardson, TX 75083-3871 <standard disclaimer applies> ------------------------------------------------------------------------------- --- [ 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 ]
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads