My guess, and this is only a guess, is that NSValue only uses the type property to make sure two NSValues have the same layout before calling memcmp (or such) on them. We have a lot of evidence that it doesn't do a deep inspection of the type in order to give a more accurate comparison.
Can you not bzero() the structs before writing to them and placing them in NSValues? That would solve your problem. On Sun, Aug 25, 2013 at 12:34 PM, Andreas Grosam <agro...@onlinehome.de>wrote: > > On 24.08.2013, at 23:01, Jean-Daniel Dupas <devli...@shadowlab.org> wrote: > > > > > Le 24 août 2013 à 22:09, Andreas Grosam <agro...@onlinehome.de> 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 (Cocoa-dev@lists.apple.com) > > 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: > > https://lists.apple.com/mailman/options/cocoa-dev/stephen.butler%40gmail.com > > This email sent to stephen.but...@gmail.com > _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com