🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Felix I. Wyss Fri, 19 Apr 1996 15:01
Check whether object has been allocated on heap
#4114
Author: Felix I. Wyss
Date: Fri, 19 Apr 1996 15:01
27 lines
1820 bytes
Hello folks!

I'm sure this question has been asked many times but here is it anyway:

How can I determine whether an object has been instantiated by allocating
heap space ("new") or whether it is global/static/automatic or even a member
of an other object.
In other words: does a particular object have to be destroyed by calling
"delete" or not. 
Is there a proper (and portable) way to do determine that or is there a
proposal for the new C++ standard to achieve this functionality?
If not, what's about a function "is_dynamic(x)" (where 'x' is a pointer to
an object) that returns 1 for dynamically allocated objects and 0 in all
other cases.

I often came across situations where this information would have been very
useful. 

Thank you for your attention!

Felix (fwyss@linx.co.uk)
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads