aboutsummaryrefslogtreecommitdiff
path: root/www/compatibility.html
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-09-13 17:48:07 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-09-13 17:48:07 +0000
commit3b5b92ab39388bb180097f3234fde9239532af4c (patch)
treed707ed04925ca3f4c980abf88ba0ebfd27c8a2e1 /www/compatibility.html
parent86d3ca5317ac777b6c54c633e568926be3dcee47 (diff)
Add a compatibility note about clang not implicitly converting between objc_object* and id (and SEL, Class).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113761 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'www/compatibility.html')
-rw-r--r--www/compatibility.html22
1 files changed, 22 insertions, 0 deletions
diff --git a/www/compatibility.html b/www/compatibility.html
index c3b467f43b..bc34a863f5 100644
--- a/www/compatibility.html
+++ b/www/compatibility.html
@@ -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 @@ this problem, use the Objective-C runtime API function
</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>
<!-- ======================================================================= -->