const var NotificationName should not use static
KeithMorning opened this issue · 0 comments
KeithMorning commented
In the section of https://github.com/objc-zen/objc-zen-book#constants, we should not use static for NotificationName, or we can' t extern it for other code. For example:
//a.h
extern static NSString *const TestConstNotificationName;
//a.m
static NSString *const TestConstNotificationName = @"TestConstNotificationName";
This won't pass compile.
On other hand, a constant will be init in the global memory area. So it doesn't need a static
key word.