From 6727910726973624106
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,afd7c5d805e2c577,start
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1993-03-22 03:10:34 PST
Newsgroups: comp.std.c++
Path: sparky!uunet!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!csn!hellgate.utah.edu!fcom.cc.utah.edu!dave
From: dave@fcom.cc.utah.edu (Dave Martin)
Subject: Is delete [] always safe?
Message-ID: <1993Mar22.024915.14564@fcom.cc.utah.edu>
Sender: news@fcom.cc.utah.edu
Reply-To: dave@csulx.weber.edu
Organization: University of Utah Computer Center
X-Newsreader: TIN [version 1.1 PL8]
Date: Mon, 22 Mar 93 02:49:15 GMT
Lines: 12

Is it safe to do a delete [] pointer when pointer is not a vector?
It is not safe in the gnu gcc2.3.3 compiler.  What does/will the standard
say?  Is the only reason to require the [] on vectors to clue in the compiler
so it doesn't have to check at runtime whether it is deleteing a vector
( by seeing if sizeof(type) is < sizeof memory buffer) or is there some other
reason?  I had a program that was relying on delete [] ptr being safe for
both vectors and non-vectors until it broke.  Do I need to have special
cases?

--
dave@csulx.weber.edu (sig by ByteWatchers & TransmitFast)



