Objective-C : #define vs extern const

后端 未结 4 944
时光说笑
时光说笑 2021-02-19 22:37

I know this question has been asked before, but I can\'t seem to find information about it in Apple\'s documentation; maybe some of you guys did.

A lot of Objective-C co

4条回答
  •  北荒
    北荒 (楼主)
    2021-02-19 23:06

    Apple's recommendation is extern:

    Define constants for strings used for such purposes as notification names and dictionary keys. By using string constants, you are ensuring that the compiler verifies the proper value is specified (that is, it performs spell checking).

    Admittedly they are inconsistent about this sometimes.

提交回复
热议问题