0

【问题】code1不能编译,code2没有问题。所以为什么?【code1】</p>

#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]){
    @autoreleasepool{
        NSLog(@"\nProgram is working........\n");
        int a=15;
        int b=55;
        int sum=0;
        sum=a+b;
        NSLog(@"The equality : %i + %i= %i\n",a,b,sum);
        NSLog(@"Program is over!\n");
   }
   return 0;
}

【code2】</p>

#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]){
    NSAutoreleasePool *pool=[[NSAutoreleasePool alloc] init];
    NSLog(@"\nProgram is working........\n");
    int a=15;
    int b=55;
    int sum=0;
    sum=a+b;
    NSLog(@"The equality : %i + %i= %i\n",a,b,sum);
    NSLog(@"Program is over!\n");
    return 0;
}

【通知】</p>

这个编程环境是由GNU Gcc在win7下建立的。

希望大家说的详细些,非常感谢!</p>

4

1 回答 1

5

@autoreleasepool构造是 Apple 的 LLVM 编译器的一个特性,在 GCC 中不可用。

于 2012-08-29T08:54:58.020 回答