224
struct {
int i;
float f[3];
int a:3;
int b:2;
char c; }
In addition to the types the compiler also encodes the type specifiers. The table below describes the
encoding of the current Objective-C type specifiers:
Specifier
const
in
inout
out
bycopy
oneway
The type specifiers are encoded just before the type. Unlike types however, the type specifiers are only
encoded when they appear in method argument types.
8.3. Garbage Collection
Support for a new memory management policy has been added by using a powerful conservative
garbage collector, known as the Boehm-Demers-Weiser conservative garbage collector. It is available
from http://www.hpl.hp.com/personal/Hans_Boehm/gc/.
To enable the support for it you have to configure the compiler using an additional argument,
. You need to have garbage collector installed before building the compiler.
-enable-objc-gc
This will build an additional runtime library which has several enhancements to support the
garbage collector. The new library has a new name,
non-garbage-collected library.
When the garbage collector is used, the objects are allocated using the so-called typed memory allo-
cation mechanism available in the Boehm-Demers-Weiser collector. This mode requires precise in-
formation on where pointers are located inside objects. This information is computed once per class,
immediately after the class has been initialized.
There is a new runtime function
a so-called weak pointer reference. Such a pointer is basically hidden for the garbage collector; this
can be useful in certain situations, especially when you want to keep track of the allocated objects, yet
allow them to be collected. This kind of pointers can only be members of objects, you cannot declare a
global pointer as a weak reference. Every type which is a pointer type can be declared a weak pointer,
including
,
id
Class
Here is an example of how to use this feature. Suppose you want to implement a class whose instances
hold a weak pointer reference; the following class does this:
@interface WeakPointer : Object
{
const void* weakPointer;
}
{?=i[3f]b128i3b131i2c}
Encoding
r
n
N
o
O
V
class_ivar_set_gcinvisible()
and
.
SEL
Chapter 8. GNU Objective-C runtime features
libobjc_gc.a
which can be used to declare
to not conflict with the
Need help?
Do you have a question about the ENTERPRISE LINUX 3 - USING GCC and is the answer not in the manual?
Questions and answers