www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/03/09/13:30:11

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
Message-ID: <3C8A5484.2D4563D7@earthlink.net>
From: Martin Ambuhl <mambuhl AT earthlink DOT net>
Organization: Nocturnal Aviation
X-Mailer: Mozilla 4.77 [en] (Win95; U)
X-Accept-Language: en,de-CH,fr,ru,zh-CN,ja
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: general protection fault error
References: <u8kjo3p5q5kb41 AT corp DOT supernews DOT com>
Lines: 19
Date: Sat, 09 Mar 2002 18:29:15 GMT
NNTP-Posting-Host: 209.246.105.254
X-Complaints-To: abuse AT earthlink DOT net
X-Trace: newsread1.prod.itd.earthlink.net 1015698555 209.246.105.254 (Sat, 09 Mar 2002 10:29:15 PST)
NNTP-Posting-Date: Sat, 09 Mar 2002 10:29:15 PST
X-Received-Date: Sat, 09 Mar 2002 10:29:17 PST (newsmaster1.prod.itd.earthlink.net)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"S. Kaleyta" wrote:
> 
> Is it possible to delete a pointer?  I get a "general protection fault"
> error when compiled and run on my pc but not on my unix box.
> 
> Code segment:
> int *pnt;
> pnt = &num;
> delete pnt;

Use delete and delete[] only for storage obtained through 'new', just as
you use free() only for storage obtained through the *alloc() family.
Doing otherwise (as in your fragment) is meaningless.


-- 
It is better that the grammarians should chide us
than that the people should not understand us.
  - St. Augustine

- Raw text -


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