You use it when you implement forward:(SEL):(marg_list) on a root class and want to create an NSInvocation out of the forwarded marg_list parameter. Then one pulls out the parameters from the marg_list and stuffs them into an NSInvocation. Using forwarding makes your code way fast obviously...
To pull a parameter from marg_list you use directly or indirectly marg_getRef. This is marg_getRef:
#define marg_getRef(margs, offset, type) \ ( (type *)((char *)margs + marg_adjustedOffset(method,offset) ) )Yes method is not a macro parameter...
It turns out well in the end though, because method isn't really used.
#if defined(__ppc__) || defined(ppc) #define marg_prearg_size 128 #else #define marg_prearg_size 0 #endif #define marg_adjustedOffset(method, offset) \ (marg_prearg_size + offset)
This doesn't inspire a whole lot of confidence. Rightfully so, because it doesn't work.
One would assume you use marg_getRef to sequentially access the marg_list by adding the size of the previously retrieved data to the offset parameter. But that fails when it should pick up the floating point parameters. These are located at offset 0 regardless.
OK it's debatable if that means "does not work" because basically, it's just a peek and poke and it does just that. But I fail to see in what regard this macro is helping me with anything. It's an interface to a type that is opaque but that you can't use, when you don't know how it is made up internally.