delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/05/03/06:15:09

From: "Rafal Maj" <maj_rafal AT poczta DOT onet DOT pl>
Newsgroups: comp.os.msdos.djgpp
Subject: Deleting after strdup
Date: Thu, 3 May 2001 12:01:12 +0200
Organization: Academic Computer Center CYFRONET AGH
Lines: 9
Message-ID: <9crage$5td$1@info.cyf-kr.edu.pl>
NNTP-Posting-Host: d-94-53-26.cyfronet.krakow.pl
X-Trace: info.cyf-kr.edu.pl 988884302 6061 149.156.1.186 (3 May 2001 10:05:02 GMT)
X-Complaints-To: news AT cyf-kr DOT edu DOT pl
NNTP-Posting-Date: Thu, 3 May 2001 10:05:02 +0000 (UTC)
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

Sorry for newbie question... after char* s = strdup(...); I should use
delete[] s; ?
delete s; is wrong ?
Can I saftly use strdup() with variables that can be NULL ? For example,
should I use every time :
char *s;  if (org) s=strdup(org); else s=NULL;
or is it safe to use char *s = strdup(org); ?


- Raw text -


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