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 | 5471bc85b69912e3b448de004498a80c0de32296 (patch) | |
tree | 722748ed81ac2868f8f853092a64891c338fbf99 /docs/LanguageExtensions.html | |
parent | 6aff47db98890aa537edfb579b21d11d5ea3d1cd (diff) |
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>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139297 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs/LanguageExtensions.html')
-rw-r--r-- | docs/LanguageExtensions.html | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/docs/LanguageExtensions.html b/docs/LanguageExtensions.html index a7d8019f97..79c42fda2e 100644 --- a/docs/LanguageExtensions.html +++ b/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> <!-- ======================================================================= --> |