This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
How to be Garbage Collector safe.
- To: egcs at egcs dot cygnus dot com
- Subject: How to be Garbage Collector safe.
- From: Kevin Atkinson <kevinatk at home dot com>
- Date: Fri, 27 Aug 1999 20:55:39 -0400
After asking about if gcc is garbage collector safe I got two basic
answers:
Jeffrey A Law <law@cygnus.com> answer was: No, because "I *know* GCC
will create situations which will spoof a garbage collector." However,
Per Bothner <per@bothner.com>, answered with, it is a theoretical
problem, but in practices these hypothetical situations don't come up.
So my question is: What can *I* do as a C++ programmer to make sure the
optimizer doesn't screw with my variables like jeff said. Would always
having a pointer marked with volatile do the trick such as:
class Y;
class X {
volatile Y * ptr;
...
};
do the trick. What other things can I do to make sure that I don't have
dangling reference do to premature garbage collections?
--
Kevin Atkinson
kevinatk@home.com
http://metalab.unc.edu/kevina/