This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

How to be Garbage Collector safe.


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]