home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!news.encore.com!news!jpolito
- From: jpolito@sysgem1.encore.com (Jonathan Polito)
- Subject: Re: Should char arrays be deleted with delete[]?
- Organization: Encore Computer Corp.
- Date: Fri, 18 Dec 1992 18:53:29 GMT
- Message-ID: <JPOLITO.92Dec18135329@sysgem1.encore.com>
- In-Reply-To: fogel@promis.com's message of Fri, 18 Dec 1992 16:13:38 GMT
- References: <1992Dec18.161338.28124@promis.com>
- Sender: news@encore.com (Usenet readnews user id)
- Nntp-Posting-Host: sysgem1.encore.com
- Lines: 29
-
-
- In article <1992Dec18.161338.28124@promis.com> fogel@promis.com (Richard Fogel) writes:
-
- Should char strings allocated as follows:
-
- char *str = new char[10];
-
- later be deleted by:
-
- delete []str OR delete str ?
-
- Thanks, this would be a great help, as the texts do not realy address this
- issue, and I understand that the wrong delete approach will cause unexplained
- results.
-
- Richard Fogel
-
-
- See the ARM 5.3.4: "The form delete [] cast-expression is used to
- delete arrays. The expression points to an array...The effect of
- deleting an array with the plain delete syntax is undefined, as is
- deleting an individual object with the delete [] syntax."
-
- Now if only the InterViews folks would read the ARM.
-
- --
- Jonathan E. Polito Internet: jpolito@encore.com
- Encore Computer Corp, 901 Kildaire Farm Rd, Cary, NC 27511 USA
- 919-481-3730/voice 919-481-3868/FAX
-