Article View: comp.std.c++
Article #40Re: New/Constructor & Destructor/Delete Relationship
From: John MAX Skaller
Date: Wed, 04 Nov 1992 06:45
Date: Wed, 04 Nov 1992 06:45
29 lines
1614 bytes
1614 bytes
In article <pathak-291092115943@maclab1-e.mitre.org> pathak@mitre.org (Heeren Pathak) writes:
>
>I have a situation where I need to know how an object was created
>(dynamically or on the stack) and have delete only delete dynamic objects.
I wonder if the language could be extended to allow the storage
class of the thing pointed to by a pointer to be an attribute of the pointer.
For example suppose we have:
int heap* x;
int global* y;
int stack* z;
analogously to 'const' and 'volatile', then
delete y; // compile time error
delete z; // compile time error
int heap& f(){ ... return *z;} // compile time error
We could then make linked lists of pointers to heap objects.
Mm. Doesnt stop dangling pointers though.
--
;----------------------------------------------------------------------
JOHN (MAX) SKALLER, maxtal@extro.ucc.su.oz.au
Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
Technical Details
Message-ID:
<1992Nov4.064531.6686@ucc.su.OZ.AU>Path:
arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!decwrl!sdd.hp.com!zaphod.mps.ohio-state.edu!rpi!batcomputer!munnari.oz.au!metro!extro.ucc.su.OZ.AU!maxtalReferences:
<pathak-291092115943@maclab1-e.mitre.org>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c++ Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!decwrl!sdd.hp.com!zaphod.mps.ohio-state.edu!rpi!batcomputer!munnari.oz.au!metro!extro.ucc.su.OZ.AU!maxtal From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) Subject: Re: New/Constructor & Destructor/Delete Relationship Message-ID: <1992Nov4.064531.6686@ucc.su.OZ.AU> Sender: news@ucc.su.OZ.AU Nntp-Posting-Host: extro.ucc.su.oz.au Organization: MAXTAL P/L C/- University Computing Centre, Sydney References: <pathak-291092115943@maclab1-e.mitre.org> Date: Wed, 4 Nov 1992 06:45:31 GMT Lines: 29