[cfe-commits] r113761 - /cfe/trunk/www/compatibility.html
Argyrios Kyrtzidis
akyrtzi at gmail.com
Mon Sep 13 10:48:07 PDT 2010
Author: akirtzidis
Date: Mon Sep 13 12:48:07 2010
New Revision: 113761
URL: http://llvm.org/viewvc/llvm-project?rev=113761&view=rev
Log:
Add a compatibility note about clang not implicitly converting between objc_object* and id (and SEL, Class).
Modified:
cfe/trunk/www/compatibility.html
Modified: cfe/trunk/www/compatibility.html
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/www/compatibility.html?rev=113761&r1=113760&r2=113761&view=diff
==============================================================================
--- cfe/trunk/www/compatibility.html (original)
+++ cfe/trunk/www/compatibility.html Mon Sep 13 12:48:07 2010
@@ -40,6 +40,7 @@
<ul>
<li><a href="#super-cast">Cast of super</a></li>
<li><a href="#sizeof-interface">Size of interfaces</a></li>
+ <li><a href="#objc_objs-cast">Internal Objective-C types</a></li>
</ul>
</li>
<li><a href="#c++">C++ compatibility</a>
@@ -234,6 +235,27 @@
</pre>
<!-- ======================================================================= -->
+<h3 id="objc_objs-cast">Internal Objective-C types</h3>
+<!-- ======================================================================= -->
+
+<p>GCC allows using pointers to internal Objective-C objects, <tt>struct objc_object*</tt>,
+<tt>struct objc_selector*</tt>, and <tt>struct objc_class*</tt> in place of the types
+<tt>id</tt>, <tt>SEL</tt>, and <tt>Class</tt> respectively. Clang treats the
+internal Objective-C structures as implementation detail and won't do implicit conversions:
+
+<pre>
+t.mm:11:2: error: no matching function for call to 'f'
+ f((struct objc_object *)p);
+ ^
+t.mm:5:6: note: candidate function not viable: no known conversion from 'struct objc_object *' to 'id' for 1st argument
+void f(id x);
+ ^
+</pre>
+
+<p>Code should use types <tt>id</tt>, <tt>SEL</tt>, and <tt>Class</tt>
+instead of the internal types.</p>
+
+<!-- ======================================================================= -->
<h2 id="c++">C++ compatibility</h3>
<!-- ======================================================================= -->
More information about the cfe-commits
mailing list