• 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: How to detect endian-ness in Swift?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to detect endian-ness in Swift?


  • Subject: Re: How to detect endian-ness in Swift?
  • From: "Gerriet M. Denkmann" <email@hidden>
  • Date: Thu, 24 Jul 2014 10:26:59 +0700

On 24 Jul 2014, at 10:02, Marco S Hyman <email@hidden> wrote:

> This works fine:
>> var encoding : UInt
>> if Int(littleEndian: 42) == 42
>> {
>> 	// is little endian
>> 	encoding = NSUTF32LittleEndianStringEncoding;
>> }
>> else
>> {
>> 	encoding = NSUTF32BigEndianStringEncoding;
>> }
>>
>> But it creates a warning: "Will never be executed" for the big-endian case.
>> I'm sure there will be a Swift endian build configuration switch "real soon now". So I will just live with this warning for now.
>
> Invert your test (test for big endian) to get rid of the warning.

Excellent idea. Works perfectly.
Is this behaviour a known compiler bug or a documented feature?

Kind regards,

Gerriet.


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: How to detect endian-ness in Swift?
      • From: Marco S Hyman <email@hidden>
References: 
 >How to detect endian-ness in Swift? (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: How to detect endian-ness in Swift? (From: Chris Lattner <email@hidden>)
 >Re: How to detect endian-ness in Swift? (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: How to detect endian-ness in Swift? (From: Marco S Hyman <email@hidden>)

  • Prev by Date: Re: How to detect endian-ness in Swift?
  • Next by Date: Re: How to detect endian-ness in Swift?
  • Previous by thread: Re: How to detect endian-ness in Swift?
  • Next by thread: Re: How to detect endian-ness in Swift?
  • Index(es):
    • Date
    • Thread