diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-09-08 17:18:35 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-09-08 17:18:35 +0000 |
commit | 8b7d403684c89f3ef7fdf5c33f46d55918e0f85b (patch) | |
tree | e5656fdb5c4650153a07542156e7fce3dab50d47 /clang/docs/LanguageExtensions.html | |
parent | d98e424716bd887860dd8ff632c244e6fc083806 (diff) | |
download | bcm5719-llvm-8b7d403684c89f3ef7fdf5c33f46d55918e0f85b.tar.gz bcm5719-llvm-8b7d403684c89f3ef7fdf5c33f46d55918e0f85b.zip |
Allow C++0x enumerations with a fixed underlying type in
Objective-C. The @encode'ing of such an enumeration type is the same
as its underlying type. <rdar://problem/5276348>.
llvm-svn: 139297
Diffstat (limited to 'clang/docs/LanguageExtensions.html')
-rw-r--r-- | clang/docs/LanguageExtensions.html | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/clang/docs/LanguageExtensions.html b/clang/docs/LanguageExtensions.html index a7d8019f975..79c42fda2e9 100644 --- a/clang/docs/LanguageExtensions.html +++ b/clang/docs/LanguageExtensions.html @@ -81,6 +81,7 @@ <ul> <li><a href="#objc_instancetype">Related result types</a></li> <li><a href="#objc_arc">Automatic reference counting</a></li> + <li><a href="#objc_fixed_enum">Enumerations with a fixed underlying type</a></li> </ul> </li> <li><a href="#overloading-in-c">Function Overloading in C</a></li> @@ -774,6 +775,24 @@ returns <tt>id</tt>.</p> <p>Clang provides support for <a href="AutomaticReferenceCounting.html">automated reference counting</a> in Objective-C, which eliminates the need for manual retain/release/autorelease message sends. There are two feature macros associated with automatic reference counting: <code>__has_feature(objc_arc)</code> indicates the availability of automated reference counting in general, while <code>__has_feature(objc_arc_weak)</code> indicates that automated reference counting also includes support for <code>__weak</code> pointers to Objective-C objects.</p> <!-- ======================================================================= --> +<h2 id="objc_fixed_enum">Enumerations with a fixed underlying type</h2> +<!-- ======================================================================= --> + +<p>Clang provides support for C++0x enumerations with a fixed +underlying type within Objective-C. For example, one can write an +enumeration type as:</p> + +<pre> +typedef enum : unsigned char { Red, Green, Blue } Color; +</pre> + +<p>This specifies that the underlying type, which is used to store the +enumeration value, is <tt>unsigned char</tt>.</p> + +<p>Use <tt>__has_feature(objc_fixed_enum)</tt> to determine whether +support for fixed underlying types is available in Objective-C.</p> + +<!-- ======================================================================= --> <h2 id="overloading-in-c">Function Overloading in C</h2> <!-- ======================================================================= --> |