From: Damian Yerrick Newsgroups: comp.os.msdos.djgpp Subject: Re: strdup() with delete[] Organization: Pin Eight Software http://pineight.8m.com/ Message-ID: References: <8pgtns$sja$1 AT info DOT cyf-kr DOT edu DOT pl> X-Newsreader: Forte Agent 1.7/32.534 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Lines: 25 X-Trace: /Kw5eC5oHnU5/zdYZUbmtskSAW2ToWjTzHgEcejMaQPH24OTkluduAqhjCW0MAXzu8Hcl2a3OKnd!ii3AExXZjGX5NHClkvxtzHjALA2mRoIZKf7OjDWbI88ZJ1fHeAJAOIBoESVndoSMLnmmdUa6KrEM!Tyc= X-Complaints-To: abuse AT gte DOT net X-Abuse-Info: Please be sure to forward a copy of ALL headers X-Abuse-Info: Otherwise we will be unable to process your complaint properly NNTP-Posting-Date: Sun, 10 Sep 2000 22:21:22 GMT Distribution: world Date: Sun, 10 Sep 2000 22:21:22 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com On Sun, 10 Sep 2000 23:18:07 +0200, "Rafał Maj" wrote: >All memory allocated like > char* s = new char[100]; >should be deleted using : > delete s[]; >right ? delete[] s; >And what about allocation done with strdup() : > char* s = strdup("test"); >should I use then delete s[]; OR delete s; ? Neither. strdup() is part of the C library, so you use the C function free(s); -- MS (n) 1. A debilitating and surprisingly widespread affliction that renders the sufferer barely able to perform the simplest task. 2. A disease, multiple sclerosis (see). This is McAfee VirusScan. Add these two lines to your signature to prevent the spread of signature viruses. http://www.mcafee.com/