Re: KVC broken in 10.4.4 on Intel?
Re: KVC broken in 10.4.4 on Intel?
- Subject: Re: KVC broken in 10.4.4 on Intel?
- From: Jim Correia <email@hidden>
- Date: Mon, 30 Jan 2006 11:39:25 -0500
On Jan 30, 2006, at 2:38 AM, Da Woon Jung wrote:
Also, why _not_ use setValue:forKey:? Do you have any _set<key>
setters in your code?
No, I'm using takeValue:forKey because I'm still targeting 10.2 for
ppc. An #ifdef would allow me to use setValue:forKey: for Intel
compiles, but would using setValue:forKey: make a difference? I'm
still looking for any documentation that says it would.
DW,
It appears that -setValue:forKey: works fine for scalar floats on
Intel, but -takeValue:forKey: does not. (See sample code below.)
It seems like filing a bug and modifying your code would be prudent.
Jim
#import <Cocoa/Cocoa.h>
@interface MyObject : NSObject
{
}
- (void)setFloat:(float)value;
@end
@implementation MyObject
- (void)setFloat:(float)value
{
NSLog(@"value = %.2f", value);
}
@end
int main(int argc, char *argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
MyObject *object = [[MyObject alloc] init];
NSNumber *number = [NSNumber numberWithFloat: 2.145f];
[object setValue: number forKey: @"float"];
[object takeValue: number forKey: @"float"]; // causes garbage to be
printed on Intel
[object release];
[pool release];
return 0;
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden