• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSValue valueWithBytes:objCType:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: NSValue valueWithBytes:objCType:
      • From: "Stephen J. Butler" <email@hidden>
References: 
 >NSValue valueWithBytes:objCType: (From: Andreas Grosam <email@hidden>)
 >Re: NSValue valueWithBytes:objCType: (From: Jean-Daniel Dupas <email@hidden>)

  • Prev by Date: Re: Modifying the default -Prefix.pch file
  • Next by Date: Re: NSValue valueWithBytes:objCType:
  • Previous by thread: Re: NSValue valueWithBytes:objCType:
  • Next by thread: Re: NSValue valueWithBytes:objCType:
  • Index(es):
    • Date
    • Thread