[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: macros
From: |
Helge Hess |
Subject: |
Re: macros |
Date: |
Fri, 23 Feb 2001 16:38:19 +0100 |
David Relson wrote:
> The macros have different definitions depending on the environment. I
> don't recall all the particulars, but I remember seeing one set of
> definitions for garbage collection and another set of autorelease pools.
Exactly. GC was the initial reason to introduce the macros.
> While looking at the macros and their usage, I did notice an oddity: In
> approx 6 modules, both AUTORELEASE and RETAIN are used. For example in
> NSTimeZone.m, the following lines appear:
>
> zone = AUTORELEASE(RETAIN(defaultTimeZone));
> zone = AUTORELEASE(RETAIN(systemTimeZone));
>
> These seem really odd.
No, this isn't odd at all. This would be odd and a NOOP:
RELEASE(RETAIN(defaultTimeZone));
AUTORELEASE ensures that the object will be life in the current
execution context (method/return value) / autoreleasepool transaction.
> First, using both RETAIN and AUTORELEASE gives an
> expensive NOP - their effects cancel one another (in an involved,
> time-consuming manner). Second, with NextStep it was considered a mistake
> to call autorelease twice for the same object. Tracing through the code, I
> found 3 occurrences of the defaultTimeZone in the autorelease pool.
You can call autorelease 100 times and it's still not a mistake, neither
on NeXTstep (with Foundation) nor on GNUstep - as long as it happens
balanced.
Greetings
Helge
--
SKYRIX Software AG - http://www.skyrix.com/
Visit us at CeBIT: hall 4 / booth E52,(414)
- macros, ian . mondragon, 2001/02/22
- Re: macros, Richard Frith-Macdonald, 2001/02/23
- Re: macros, David Relson, 2001/02/23
- Re: macros,
Helge Hess <=
- Re: macros, Richard Frith-Macdonald, 2001/02/23
- Re: macros, Richard Frith-Macdonald, 2001/02/23
- Re: macros, Richard Frith-Macdonald, 2001/02/23