Xcode 4.4中没有格式安全警告
使用Xcode 4.4,我没有从这段代码中得到任何格式安全警告(Xcode 4.4中没有格式安全警告,xcode,llvm,string-formatting,xcode4.4,Xcode,Llvm,String Formatting,Xcode4.4,使用Xcode 4.4,我没有从这段代码中得到任何格式安全警告(-Wformat security): #import <Foundation/Foundation.h> int main(int argc, const char * argv[]) { @autoreleasepool { // a = @"%@" or a = @"%@%@" NSString *a = [@"%@" stringByAppendingFormat:@
-Wformat security
):
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[])
{
@autoreleasepool {
// a = @"%@" or a = @"%@%@"
NSString *a = [@"%@" stringByAppendingFormat:@"%@", arc4random_uniform(2)? @"%@": @"", nil];
// 50% change of crash, but no warning
NSLog(a, @"Hello, World!");
}
return 0;
}
#导入
int main(int argc,const char*argv[]
{
@自动释放池{
//a=@“%@”或a=@“%@”
NSString*a=[@“%@”stringByAppendingFormat:@“%@”,arc4random_uniform(2)?@“%@”:“零”;
//50%的碰撞变化,但没有警告
NSLog(一个“你好,世界!”);
}
返回0;
}
这是正常的还是我在Xcode中禁用了这个警告
我刚刚用这段代码创建了这个项目,所以它没有改变默认的项目设置。Xcode 4.4使用了新版本的LLVM和Clang,以前版本的Xcode是否导致-Wformat security亮起?@jessedc是的,至少在Xcode 4.2中显示了它。我不知道Xcode 4.3。嗯。。。这确实是一个LLVM问题。