No format security warnings in Xcode 4.4

爱⌒轻易说出口 提交于 2019-12-06 13:23:49

问题


I don't get any format security warnings (-Wformat-security) from this code using Xcode 4.4:

#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;
}

Is this normal or have I somehow disabled this warning in Xcode?

I have just created the project with this code, so it haven't changed the project settings from the default.

来源:https://stackoverflow.com/questions/11838220/no-format-security-warnings-in-xcode-4-4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!