[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: clang and libobjc2
From: |
David Chisnall |
Subject: |
Re: clang and libobjc2 |
Date: |
Fri, 26 Mar 2010 13:42:22 +0000 |
On 26 Mar 2010, at 13:28, Eddie McCreary wrote:
> Am I missing something obvious or is the new runtime too young to use yet?
> Thanks.
I'm missing something. These will generate exactly the same code, so if the
runtime works in one instance it will work in the other. I have just tried
this test case:
#import <Foundation/Foundation.h>
@implementation NSString(print)
- (void)print
{
printf("%s", [self UTF8String]);
}
@end
int main(void)
{
[NSAutoreleasePool new];
id o = [NSString stringWithUTF8String:"hello world\n"];
[o print];
NSString *s = o;
[s print];
return 0;
}
This gives exactly the same result with clang, clang -fobjc-nonfragile-abi and
GCC, all with libobjc2: It prints hello world twice.
If you are having problems, please try to see whether it is a clang or libobjc2
issue by compiling with GCC. If this works, it's a clang bug. I don't see
that this can be anything other than a compiler bug (or some problem with your
code, as you didn't give a complete test case), because both of the lines that
you provided will generate identical code in a working compiler.
David
-- Sent from my Apple II