Re: NSValue valueWithBytes:objCType:
Re: NSValue valueWithBytes:objCType:
- Subject: Re: NSValue valueWithBytes:objCType:
- From: Andreas Grosam <email@hidden>
- Date: Sun, 25 Aug 2013 19:34:12 +0200
On 24.08.2013, at 23:01, Jean-Daniel Dupas <email@hidden> wrote:
>
> Le 24 août 2013 à 22:09, Andreas Grosam <email@hidden> a écrit :
>
>
> That's not a problem specifics to NSValue.
I disagree. Please read the documentation of NSValue:
valueWithBytes:objCType:
Creates and returns an NSValue object that contains a given value, which is interpreted as being of a given Objective-C type.
isEqualToValue:
Returns a Boolean value that indicates whether the receiver and another value are equal.
The fact is, the result of isEqualToValue: is more often undefined, implementation defined or completely random when applied to structs.
> You should know what you do when manipulating structs.
I think, I do - otherwise, I wouldn't come up with this problem. The problem is, that in some library which we cannot mention here, two encoded structs wrapped into NSValues together with method isEqualToValue: will be used as a means to compare structs. IMO, this's not a reliable approach.
Andreas
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden