This question already has an answer here:
- Why does #define not require a semicolon? 7 answers
In Objective-C you can define macros using the #define
#define kSomeMacro 1024
and then use that macro for something like this...
if (kSomeMacro == 1024) {
....
}
However if you define your macro with a colon on the end
#define kSomeMacro 1024;
Then the if statement won't work. What is the reasoning behind this and why doesn't the complier complain if you put a ;
when defining the macro?