C++ question with "delete" 
Author Message
 C++ question with "delete"

In some texts like Stroustrup (2nd Ed, pg 500) there are two
forms of delete
    delete expr
    delete [] expr
and the second one is mandatory for pointers to arrays.

But all the code I look at in places I find never uses the
second form, and I vaguely thought that the second syntax
had become redundant.   (Lots of places in GNUC libraries
and Borland libraries where strings etc. are deleted with
the first syntax...
    char *p = new char [20];
     ...
     delete p;     (not delete [] p;)

What is the current state of affairs, did the standards change,
and more importantly, where can I get up-to-date reference manual,
preferably electronically.

Thanks
Pete
--
EP Wentworth - Dept. of Comp. Sci. - Rhodes University - Grahamstown - RSA.



Fri, 23 Aug 1996 23:03:41 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Question about the operator "delete"

2. Turbo C++, "Borland C++", patches questions

3. Why can only undo "Delete"?

4. Delete "/" from char pointer

5. Deleting with "fwrite()"

6. ODBC, VFP and "real" deletes

7. how to use "delete"?

8. "delete []" in MSDN

9. "scalar deleting destructor"

10. Error when "delete[] m_pHashTable" in CMap

11. SUMMARY: "Deleting every other byte"

12. Can't "delete []"

 

 
Powered by phpBB® Forum Software