这似乎是一个完全有效的程序:
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]) {
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSString* hey = @"hey"
@"there";
NSLog(@"%@",hey);
[pool drain];
return 0;
}
在 llvm gcc 和 apple llvm 中编译它不会显示任何警告或错误。为什么?似乎应该警告这一点,因为我只能认为这是引起混乱的。尤其是在这样的情况下:
NSArray* a = [NSArray arrayWithObjects:@"one",
@"two,
@"three
@"four",
nil];
你会期待四个条目......但没有!棘手,是吗?是因为您可能希望将字符串定义拆分为多行吗?