Using the GNU Compiler Collection
Language Standards Supported by GCC
GCC支持的语言标准
2.3 Objective-C and Objective-C++ Languages
GCC supports“traditional”Objective-C(also known as“Objective-C 1.0”) and contains support for the Objective-C exception and synchronization syntax.
GCC支持”传统的” Objective-C(也称为“Objective-C 1.0”),并支持 Objective-C 异常和同步语法。
It has also support for a number of“Objective-C 2.0”language extensions, including properties, fast enumeration (only for Objective-C),
method attributes and the @optional and @required keywords in protocols.
它还支持一些”Objective-C 2.0”语言扩展, 包括属性, 快速枚举(仅适用于Objective-C), 方法属性和协议中的@optional和@required关键字。
GCC supports Objective-C++ and features available in Objective-C are also available in Objective-C++.
GCC也支持Objective-C++,Objective-C 中可用的特性同样也可以在 Objective-C++ 中使用。
GCC by default uses the GNU Objective-C runtime library, which is part of GCC and is not the same as the Apple/NeXT Objective-C runtime library used on Apple systems.
GCC默认使用GNU Objective-C运行库,它是GCC的一部分,与Apple系统上使用的 Apple/NeXT Objective-C运行时库不同。
There are a number of differences documented in this manual.
本手册中记录了若干差异。
The options‘-fgnu-runtime’and ‘-fnext-runtime’allow you to switch between producing output that works
with the GNU Objective-C runtime library and output that works with the Apple/NeXT ObjectiveC runtime library.
选项
'-fgnu-runtime'和'-fnext-runtime'允许你在GNU和Apple/NeXTObjective-C 运行时库 之间进行切换并产生相应的输出
There is no formal written standard for Objective-C or Objective-C++.
Objective-C 或 Objective-C ++并没有正式的书面标准。(意思是没有类似C或C++那种正式发表的语言标准 )
The authoritative manual on traditional Objective-C (1.0) is “Object-Oriented Programming and the Objective-C Language”: http://www.gnustep.org/resources/documentation/ObjectivCBook.pdf is the original NeXTstep document.
传统Objective-C(1.0)的权威手册是“面向对象编程和Objective-C语言”:
http://www.gnustep.org/resources/documentation/ObjectivCBook.pdf 是原始的NeXTstep文档。
The Objective-C exception and synchronization syntax (that is, the keywords @try, @throw, @catch, @finally and @synchronized) is supported by GCC and is enabled with the option ‘-fobjc-exceptions’.
GCC支持 Objective-C 异常和同步语法(即关键字@try,@throw,@catch,@finally和@synchronized),并默认启用了选项
'-fobjc-exceptions'。
The syntax is briefly documented in this manual and in the Objective-C 2.0 manuals from Apple.
本手册和Apple的Objective-C 2.0手册中简要介绍了语法。
The Objective-C 2.0 language extensions and features are automatically enabled;
Objective-C 2.0 语言扩展和功能自动启用
they include properties (via the @property, @synthesize and @dynamic keywords),
fast enumeration (not available in Objective-C++),
attributes for methods (such as deprecated, noreturn, sentinel, format),
the unused attribute for method arguments,
the @package keyword for instance variables and the @optional and @required keywords in protocols.
它们包括属性(@property,@synthesize 和 @dynamic 关键字),
快速枚举(在Objective-C ++中不可用),
方法的属性(如 deprecated,noreturn,sentinel,format),
未使用的方法参数的属性,
实例变量的 @package 关键字和协议中的 @optional 和 @required 关键字。
You can disable all these Objective-C 2.0 language extensions with the option ‘-fobjc-std=objc1’,
which causes the compiler to recognize the same Objective-C language syntax recognized by GCC 4.0,
and to produce an error if one of the new features is used.
您可以使用选项
'-fobjc-std = objc1'禁用所有这些 Objective-C 2.0 语言扩展,
这将导致编译器 与 GCC 4.0 一样来识别 Objective-C 语言语法,并且如果使用某个新功能将会产生错误。
GCC has currently no support for non-fragile instance variables.
GCC目前不支持 non-fragile 实例变量。
The authoritative manual on Objective-C 2.0 is available from Apple:
https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/Introduction/Introduction.html
Objective-C 2.0的权威手册可从Apple获得:
For more information concerning the history of Objective-C that is available online, see http://gcc.gnu.org/readings.html
有关Objective-C历史的更多信息可以在线获得,详见 http://gcc.gnu.org/readings.html

本文介绍了GCC如何支持Objective-C及Objective-C++语言标准,包括传统Objective-C1.0及Objective-C2.0的特性。重点讲解了GCC对Objective-C异常、同步语法的支持,以及Objective-C2.0中的新特性,例如属性、快速枚举等。
1502

被折叠的 条评论
为什么被折叠?



