delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/08/17/13:15:28

From: "Rafał Maj" <r_maj AT poczta DOT onet DOT pl>
Newsgroups: comp.os.msdos.djgpp
Subject: Odp: delete OR delete[] ?
Date: Thu, 17 Aug 2000 18:56:39 +0200
Organization: Academic Computer Center CYFRONET AGH
Lines: 23
Message-ID: <8nh5qk$h21$3@info.cyf-kr.edu.pl>
References: <8ngta8$27b$2 AT info DOT cyf-kr DOT edu DOT pl> <399c05a2$1_1 AT news DOT uni-bielefeld DOT de>
NNTP-Posting-Host: d-94-53-08.cyfronet.krakow.pl
X-Trace: info.cyf-kr.edu.pl 966531732 17473 149.156.1.168 (17 Aug 2000 17:02:12 GMT)
X-Complaints-To: news AT cyf-kr DOT edu DOT pl
NNTP-Posting-Date: 17 Aug 2000 17:02:12 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2615.200
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Manni Heumann <manni DOT heumann AT gmx DOT de> wrote :
> "Rafał Maj" <r_maj AT poczta DOT onet DOT pl> wrote:
> >What is difference between delete and delete[] ?
[...]

Is this example correct ?

class cTest { public :
  void* operator new(unsigned long SIZE) { return new char[SIZE]; }
  void operator delete(void* THIS) { delete[] (char*)THIS; }
  void operator delete[](void* THIS) { delete[] (char*)THIS;  }
};

main() {
  cTest *ptr = new cTest;         delete ptr;
  cTest *arr = new cTest[20];  delete[] arr;
}





- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019