• 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: Variable type representations
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Variable type representations


  • Subject: Re: Variable type representations
  • From: Quincey Morris <email@hidden>
  • Date: Fri, 11 Mar 2016 12:55:41 -0800
  • Feedback-id: 167118m:167118agrif8a:167118sRg9yomjMA:SMTPCORP

On Mar 11, 2016, at 12:43 , Carl Hoefs <email@hidden> wrote:
>
> Q1: How can 'long' and 'long long' have the same 8-byte representation?

Go complain to the gods of C. That language is responsible for the concept:

	sizeof (int) <= sizeof (long) <= sizeof (long long)

Note the “=“ signs. (It’s all about getting the “natural-est” variable size on heterogeneous platforms.)

> Q2: How to get an unsigned long int value from an NSString? Use NSInteger?

For any reasonable (i.e. 64-bit) OS X app, just use ‘unsignedIntegerValue’ and cast the result. If you want compatibility with 32-bit architecture, use ‘unsignedLongLongValue’ and cast the result. (You can use the latter in either case, but it’s a bit of a mouthful.)

_______________________________________________

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: Variable type representations
      • From: Quincey Morris <email@hidden>
References: 
 >Variable type representations (From: Carl Hoefs <email@hidden>)

  • Prev by Date: Variable type representations
  • Next by Date: Re: Variable type representations
  • Previous by thread: Variable type representations
  • Next by thread: Re: Variable type representations
  • Index(es):
    • Date
    • Thread