I'm learning objective-C and Cocoa. In the Apple tutorial I'm working through there's a side note that says:
IBOutletis a null-defined macro, which the C preprocessor removes at compile time.
I'm curious - what's a null-defined macro?
Cheers Ben
I'm learning objective-C and Cocoa. In the Apple tutorial I'm working through there's a side note that says:
IBOutletis a null-defined macro, which the C preprocessor removes at compile time.
I'm curious - what's a null-defined macro?
Cheers Ben
#define IBOutlet
Whenever IBOutlet is used in program text, it will be replaced with nothing at all.
FYI, in this particular case, the reason the IBOutlet even exists is simply so that Interface Builder can parse the source file and glean bits of understanding from it. It's a clue (well, a bit stronger than a clue) that the variable preceded by IBOutlet should show up as an Outlet in Interface Builder when designing your UIs.
A null-defined macro is a macro which will be replaced by nothing (will be removed) by the preprocessor. It's role is to give a hint about something in code, such as:
#define IN #define OUT #define INOUT int myFunction(IN char *name, INOUT char *address, OUT char *phone);
This declaration suggests that name is a input variable for the function, address is both input and output, phone is an output variable.
Also - if you're unsure how anything is defined - command double-click it and Xcode will open the definition in the original source file.