delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/09/11/05:16:12

Newsgroups: comp.os.msdos.djgpp
From: manni DOT heumann AT gmx DOT de (Manni Heumann)
Subject: Re: strdup() with delete[]
References: <8pgtns$sja$1 AT info DOT cyf-kr DOT edu DOT pl> <20000911010800 DOT C23829 AT chance DOT cz>
X-Newsreader: News Xpress 2.01
Mime-Version: 1.0
Date: Mon, 11 Sep 2000 09:12:39 GMT
NNTP-Posting-Host: dhcp33-228.uni-bielefeld.de
Message-ID: <39bca204_1@news.uni-bielefeld.de>
X-Trace: 11 Sep 2000 11:12:36 +0200, dhcp33-228.uni-bielefeld.de
Lines: 24
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

>
>I guess the [] form is considered obsolete.  I would use simple delete s. 
>The operator's implementation knows how many objects are allocated.
>

Wow! Obsolete. Try this and then tell us whether it is obsolete:

class Test {
public:
        Test () { cout << "Constructing\n"; }
        ~Test () { cout << "Destructing\n"; }
};

int main () {
        Test *t = new Test [3];
        delete t;
        return 0;
}

--

Manni

"Life would be much easier if I had the source code."

- Raw text -


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