[cfe-dev] Comparison of pointers between Objc subclasses

Ted Kremenek kremenek at apple.com
Tue Jul 1 23:30:48 PDT 2008

On Jul 1, 2008, at 9:48 PM, Eli Friedman wrote:

> On Tue, Jul 1, 2008 at 8:54 PM, Ted Kremenek <kremenek at apple.com>  
> wrote:
>> So, I think the answers we are looking for are outside the letter  
>> of C99
>> standard.  The Objective-C and C++ object type systems are a  
>> completely
>> different animal.
> Okay, so in that case typesAreCompatible should say that non-identical
> ObjC types aren't compatible, and the necessary handling for
> comparison/assignment/conditionals/whatever else is needed for ObjC
> pointers should move into SemaExpr.
> -Eli

That sounds like a reasonable plan.  Incidentally, what does:


do for these pointer types?  I've never even used this builtin, so I'm  
not quite certain how to use it in practice.  I only ask because we  
use ASTContext::typesAreCompatible to implement  
Expr::isIntegerConstantExpr for TypesCompatibleExpr.

If we can cross-check GCC's behavior with this builtin, that should  
give a definitive answer on whether or not NSArray* and  
NSMutableArray* should be considered compatible types (and hence put  
the logic in ASTContext::typesAreCompatible) or, if not, put (as you  
suggest) the necessary handling for ObjC pointers in SemaExpr.

More information about the cfe-dev mailing list