How to check for Objective 2.0 support by GCC unde

2019-08-12 22:25发布

I'm under linux and I have both clang 3.5, from the svn trunk, and gcc 4.8.1. It surprises me that I can't compile objective-c 2.0 code with gcc but I can do that with clang.

I know that gcc was the default compiler on MAC OS X for a long time before the coming of clang. So why gcc doesn't support obj-c 2.0 under linux?

clang even works fine with GNUstep, where gcc really can't keep up in terms of implemented features from the version 2.0 of the language.

For example, the autoreleasepool keyword it's not supported by gcc.

1条回答
ゆ 、 Hurt°
2楼-- · 2019-08-12 23:00

This really depends on what you mean by “Objective-C 2.0”. There's no official written specification.

Several language features that you probably think of as “Objective-C 2.0” are only supported by clang and have never been supported by gcc. These include ARC, NSNumber/NSArray/NSDictionary literals, and object subscripting. The @autoreleasepool syntax is part of ARC.

查看更多
登录 后发表回答