Why the macros in Objective-C / Cocoa?

Posted by Joe on Stack Overflow See other posts from Stack Overflow or by Joe
Published on 2010-05-19T14:38:22Z Indexed on 2010/05/19 14:40 UTC
Read the original article Hit count: 252

Filed under:
|

I'm coming from a place without macros (Java/Python/C#/Scala) so perhaps my perspective is distorted but...

Why are macros used in Cocoa? Two that spring to mind are NSLocalizedString and NSAssert (and STAssert). Would it be so hard / unsuitable to make them functions (which could be inlined)? I suppose I find them a little bizarre as an unnecessary throw-back to C (and yes, I am familiar with the pedigree of Obj-C).

Is it just something that was done back in the day or is there a specific reason?

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about macros