[cfe-commits] r124791 - /cfe/trunk/www/compatibility.html

John McCall rjmccall at apple.com
Thu Feb 3 03:05:04 PST 2011


Author: rjmccall
Date: Thu Feb  3 05:05:04 2011
New Revision: 124791

URL: http://llvm.org/viewvc/llvm-project?rev=124791&view=rev
Log:
More minor documentation tweaks.


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=124791&r1=124790&r2=124791&view=diff
==============================================================================
--- cfe/trunk/www/compatibility.html (original)
+++ cfe/trunk/www/compatibility.html Thu Feb  3 05:05:04 2011
@@ -383,19 +383,21 @@
 instead of the internal types.</p>
 
 <!-- ======================================================================= -->
-<h3 id="c_variables-class">C variables in @class or @protocol</h3>
+<h3 id="c_variables-class">C variables in @interface or @protocol</h3>
 <!-- ======================================================================= -->
 
-<p>GCC allows declaration of C variables in a @class or @protocol, but not 
-C functions. Clang does not allow variable or C function declarations. External
-declarations, however, is allowed. Variables may only be declared in an
- at implementation.
+<p>GCC allows the declaration of C variables in
+an <code>@interface</code> or <code>@protocol</code>
+declaration. Clang does not allow variable declarations to appear
+within these declarations unless they are marked <code>extern</code>.</p>
+
+<p>Variables may still be declared in an @implementation.</p>
 
 <pre>
 @interface XX
-int x;  //  not allowed in clang
-int one=1;  //  not allowed in clang
-extern int OK;
+int a;         // not allowed in clang
+int b = 1;     // not allowed in clang
+extern int c;  // allowed 
 @end
 
 </pre>
@@ -431,7 +433,7 @@
     simple as changing <tt>int size = ...;</tt> to <tt>const int size
     = ...;</tt> (if the definition of <tt>size</tt> is a compile-time
     integral constant);</li>
-<li>use an <tt>std::string</tt> instead of a <tt>char []</tt>;</li>
+<li>use <tt>std::string</tt> instead of a <tt>char []</tt>;</li>
 <li>use <tt>std::vector</tt> or some other suitable container type;
     or</li>
 <li>allocate the array on the heap instead using <tt>new Type[]</tt> -





More information about the cfe-commits mailing list