Effective objective 52个有效法则

1.多用类型常量,少用#define 预处理指令

1.对于常量定义

  • static const int time = 3; 局部定义的常量
  • extern const int time = 3; 全局常量

2.对于指针的常量

  • extern NSString *const name  //声明  (从右向左解读,一个常量,常量是一个指针)
  • NSString *const name = @"hello"; //定义,引用
posted on 2015-07-16 11:43  pTrack  阅读(93)  评论(0)    收藏  举报