discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: building dbuskit fails with llvm/clang


From: Nicola Pero
Subject: Re: building dbuskit fails with llvm/clang
Date: Sun, 10 Apr 2011 15:53:49 +0200 (CEST)

>> If you message an object of a class which is only declared using @class,
>>   you should get a warning.  Both GCC and clang don't warn about this.
>
> I think clang does.

On my machine, all compilers (both GCC and clang from trunk, as far as I can 
see)
compile the following testcase with no warnings --

#include <objc/objc.h>

@class A;

@interface B
{
  id isa;
}
- (void) doSomething;
@end

void test (A *x)
{
  [x doSomething];
}

Now, this is what all Objective-C compilers since GCC 2.95 have done, but is it
a good behaviour ?  Shouldn't we get a warning at the '[x doSomething]' line ? 
:-)

I think the correct behaviour should be to warn on that line, as the compiler
does not have enough information to decide if the method invocation makes sense
or not.  If the programmer really knows it makes sense (and for whatever 
mysterious
reason can't add a proper @interface A), they can always use "[(id)x 
doSomething]"
to turn the warnings off. ;-)

Thanks




reply via email to

[Prev in Thread] Current Thread [Next in Thread]