Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: another compiler bug, or do I overlook something?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: another compiler bug, or do I overlook something?



Hi,

On Oct 4, 2008, at 9:32 PM, Ladd Van Tol wrote:

Does your init method return an object of type "X" or of type "id"?

That's completely irrelevant. Or at the very least should be. The C assignment operator is -- far as I know and do someone please correct me if I am wrong -- defined to have the type and value of the lvalue.


Which happens to work elsewhere, try e.g.

int n;
double d=3/(n=2.);

which would store 1, not 1.5 into d.

And finally, even if my memory was weak (which it is!), casting does not help anyway:

140 /tmp> <q.m
#import <Cocoa/Cocoa.h>
@interface X:NSObject
@property(assign) id delegate;
@end
static X *x=nil;
void fnc() {
[(x=(X*)[[X alloc] init]).delegate class];
}
141 /tmp> cc -c q.m -fobjc-gc-only
q.m: In function 'fnc':
q.m:7: error: request for member 'delegate' in something not a structure or union
142 /tmp>


:)

On Oct 4, 2008, at 12:07 PM, Ondřej Čada wrote:

Hi there,

do I overlook something of importance, or is this indeed a compiler bug? Without GC it behaves all right; with GC though, it reports spurious errors:

128 /tmp> <q.m
#import <Cocoa/Cocoa.h>
@interface X:NSObject
@property(assign) id delegate;
@end
static X *x=nil;
void fnc() {
[(x=[[X alloc] init]).delegate class];
}
129 /tmp> cc -c q.m
130 /tmp> cc -c q.m -fobjc-gc-only
q.m: In function 'fnc':
q.m:7: error: request for member 'delegate' in something not a structure or union
131 /tmp>


Best,
---
Ondra Čada
OCSoftware:     email@hidden               http://www.ocs.cz
private         email@hidden             http://www.ocs.cz/oc
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Objc-language mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >another compiler bug, or do I overlook something? (From: Ondřej Čada <email@hidden>)
 >Re: another compiler bug, or do I overlook something? (From: Ladd Van Tol <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.