Bug in G++?

David Korn dkorn@pixelpower.com
Mon Nov 27 04:52:00 GMT 2000


>-----Original Message-----
>From: Kári Davíðsson [ mailto:kd@flaga.is ]
>Sent: 27 November 2000 12:02
>To: Gcc help maillist (E-mail)
>Subject: Bug in G++? 

>int main(int argc, char** argv)
>{
>	MyClass * ptr;
>	ptr = new MyClass[VECTORSIZE];
>	delete ptr;
>}

  When allocating with operator new[], you MUST use operator delete[] to get
rid of the array of objects. Although one version of your code runs 
successfully, it's just luck.

   hth, 
      DaveK
-- 
The Boulder Pledge: "Under no circumstances will I ever purchase anythingo
 ffered to me as the result of an unsolicited email message. Nor will I 
forward chain letters, petitions, mass mailings, or virus warnings to largen
 umbers of others. This is my contribution to the survival of the online
community."


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************


More information about the Gcc-help mailing list