discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Question on GC


From: David . Ayers
Subject: Question on GC
Date: Thu, 11 Apr 2002 15:49:00 +0200

Could someone point me to a place, where can I find a comprehensive
explination of how the GC macros should be used?

I often find code like:
IF_NO_GC(RETAIN(ivar))
IF_NO_GC(RELEASE(ivar))
but this seems redundant, since the RETAIN/RELEASE makros themselves should
handle the IF_NO_GC.

And could someone explain
TEST_RETAIN(ivar)
TEST_RELEASE(ivar)
TEST_AUTORELEASE(ivar)
it seems to me (granted minimal) overhead to test for nil since messages to
nil are ignored anyway (or is there more overhead in messeging nil by the
runtime?)

The documataion of DESTROY (NSObject.h) states:
 *   DESTROY() is a release operation which also sets the variable to be
 *   a nil pointer for tidyness - we can't accidentally use a DESTROYED
 *   object later.  It also makes sure to set the variable to nil before
 *   releasing the object - to avoid side-effects of the release trying
 *   to reference the object being released through the variable.
It seems unclear how a release could access the symbol passed as the macro
parameter (ahh, unless its a global symbol and it's refrenced in the
release implementation, ok granted. But maybe the documentation could
include that detail. )

Not that I'm too wild abou GC but I would just like to know how to write
code to support it.

Thanks,
Dave




reply via email to

[Prev in Thread] Current Thread [Next in Thread]