Search code examples
objective-ctypeof

What's the meaning of __typeof keyword in Objective-C context?


What's the meaning of __typeof keyword in Objective-C context?


Solution

  • The __typeof keyword has the same meaning as the typeof keyword: it is used at compile-time instead of an explicit type, to mean the type of its parameter.

    You will see __typeof in system header files because the typeof keyword is non-standard. So the typeof keyword can be disabled by a compiler flag, or the user can #define it to mean something else. The C language standard reserves all identifiers that start with __ for use by the compiler, so the compiler can define the __typeof keyword even when the typeof keyword is disabled, and the user is not supposed to #define it to mean something else.