From 3cdbe44e0d0363a2c42c516c8e1f58e07999fab3 Mon Sep 17 00:00:00 2001 From: John McCall Date: Thu, 3 Feb 2011 11:05:04 +0000 Subject: [PATCH] More minor documentation tweaks. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124791 91177308-0d34-0410-b5e6-96231b3b80d8 --- www/compatibility.html | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/www/compatibility.html b/www/compatibility.html index ddfddc7fa9..ca1553150b 100644 --- a/www/compatibility.html +++ b/www/compatibility.html @@ -383,19 +383,21 @@ void f(id x); instead of the internal types.

-

C variables in @class or @protocol

+

C variables in @interface or @protocol

-

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 -@implementation. +

GCC allows the declaration of C variables in +an @interface or @protocol +declaration. Clang does not allow variable declarations to appear +within these declarations unless they are marked extern.

+ +

Variables may still be declared in an @implementation.

 @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
 
 
@@ -431,7 +433,7 @@ template parameter. simple as changing int size = ...; to const int size = ...; (if the definition of size is a compile-time integral constant); -
  • use an std::string instead of a char [];
  • +
  • use std::string instead of a char [];
  • use std::vector or some other suitable container type; or
  • allocate the array on the heap instead using new Type[] - -- 2.40.0