How to check for Objective 2.0 support by GCC under linux?

北慕城南 提交于 2019-12-24 09:43:26

问题


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:


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.



来源:https://stackoverflow.com/questions/22275252/how-to-check-for-objective-2-0-support-by-gcc-under-linux

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