This is what I'm referring to:
From what I've read, an objc_msgSend
is essentially what is happening at the c level when you send an Objective-C message, and this setting set to Yes
ensures that the message being sent has the same number of arguments as the the receiver is expecting.
Is this correct? Also what are the advantages and disadvantages to setting this to Yes
or No
? Should I only set this to Yes
in development and No
in production?
You are essentially correct, yes.
Apple sets it to Yes by default because it helps to find errors faster. The only reason to set it to No would be because you are compiling legacy code that hasn't been updated to compile cleanly with this option on.
"Enable Strict Checking of objc_msgSend Calls" is a compile time check, not run time, so there is no benefit to turning it off in production.
There's a presentation "What's new in LLVM" on Apple's website (text of the presentation is here).
It looks like the compiler will now (optionally) strictly check the types of calls to obj_msgSend. You will have use a correctly-typed function pointer in place of directly calling objc_msgSend.
Example given:
#include <objc/message.h>
void foo(void *object) {
typedef void (*send_type)(void *, SEL, int);
send_type func = (send_type)objc_msgSend;
func(object, sel_getUid("foo:"), 5);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With