Objc.checkOffsetof

Issues a compile time error if the .offsetof/.tupleof property is used on a field of an Objective-C class.

To solve the fragile base class problem in Objective-C, fields have a dynamic offset instead of a static offset. The compiler outputs a statically known offset which later the dynamic loader can update, if necessary, when the application is loaded. Due to this behavior it doesn't make sense to be able to get the offset of a field at compile time, because this offset might not actually be the same at runtime.

To get the offset of a field that is correct at runtime, functionality from the Objective-C runtime can be used instead.

class Objc
abstract const
void
checkOffsetof

Parameters

expression Expression

the .offsetof/.tupleof expression

aggregateDeclaration AggregateDeclaration

the aggregate declaration the field of the .offsetof/.tupleof expression belongs to

See Also

Meta