🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.help
Article #580

ANSI C++ forbids array size in vector delete

#580
From: David Lovell
Date: Wed, 18 Nov 1992 07:38
34 lines
1931 bytes
Hi there,
We've just put the latest releases of gcc and libg++ up and now I'm bashing
some old code into shape. I know this is only a warning message but I'd like
to know how to get rid of it (apart from turning all the warnings off!).

The message in question has the form:
matrix.C:63: warning: ANSI C++ forbids array size in vector delete

where matrix.C:63 is:
delete [storage] store;

where store is allocated by:
store = new double [storage];

Am I right to assume that C++ no longer needs "array size in vector delete"?
I just bought a "recent" (1991) C++ text, "C++: the Complete Reference" by
Herbert Schildt which says at the top of page 334

"When an array allocated by using new is released, delete must be told how
many elements there are in the array."

Which poses the question, which C++ reference should GNU users refer to?
Thanks in advance for all your helpful replies.

David
-------------------------------------------------------------------------------
David Lovell - dlovell@s1.elec.uq.oz.au  |
                                         |
Dept. Electrical Engineering             | "Oh bother! The pudding is ruined
University of Queensland                 | completely now!" said Marjory, as
BRISBANE 4072                            | Henry the daschund leapt up and
Australia                                | into the lemon surprise.
                                         |
tel: (07) 365 3564                       |
Technical Details
Message-ID: <dlovell.722072326@s1.elec.uq.oz.au>
Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!agate!spool.mu.edu!sgiblab!munnari.oz.au!bunyip.cc.uq.oz.au!dlovell

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.help
Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!agate!spool.mu.edu!sgiblab!munnari.oz.au!bunyip.cc.uq.oz.au!dlovell
From: dlovell@elec.uq.oz.au (David Lovell)
Subject: ANSI C++ forbids array size in vector delete
Message-ID: <dlovell.722072326@s1.elec.uq.oz.au>
Keywords: g++
Sender: news@bunyip.cc.uq.oz.au (USENET News System)
Organization: Prentice Centre, University of Queensland
Date: Wed, 18 Nov 1992 07:38:46 GMT
Lines: 34