• 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: Implicit conversion loses integer precision in x86_64
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Implicit conversion loses integer precision in x86_64


  • Subject: Re: Implicit conversion loses integer precision in x86_64
  • From: Greg Weston <email@hidden>
  • Date: Sat, 13 Sep 2014 07:36:12 -0400

uint32_t. That and its relatives were defined specifically for such needs.

> So what datatype do I specify to obtain an unsigned 4-byte integer, consistent across OS X and iOS platforms?
> -Carl
>
>> On Sep 12, 2014, at 6:26 PM, Roland King <email@hidden> wrote:
>>
>>
>>> On 13 Sep 2014, at 9:17 am, Carl Hoefs <email@hidden> wrote:
>>>
>>> OS X 10.9.4, Xcode 5.1.1
>>>
>>> For my OS X app, for both Project & Target I'm building with:
>>>
>>> Architectures                    "Standard Architectures (64-bit Intel) (x86_64)'.
>>> Build Active Architecture Only   YES
>>> Supported Platforms              OS X
>>> Valid Architectures              x64_64
>>>
>>> However Xcode complains about the following:
>>>
>>>       unsigned long myvalue = 16;
>>>       unsigned int urvalue = myvalue; <—= WARNING
>>>
>>> "Implicit conversion loses integer precision: 'unsigned long' to 'uint32_t (aka 'unsigned int')"
>>>
>>> Aren't 'unsigned long' and 'unsigned int' identical 32-bit quantities in x86_64?
>>> -Carl
>>
>> No. From the admittedly rather old 64-bit transition guide. That fits with my mental model of what ‘long’ usually tends to mean.
>> Table 2-1  Size and alignment of base data types in OS X
>> Data type
>> ILP32 size
>> ILP32 alignment
>> LP64 size
>> LP64 alignment
>> char
>> 1 byte
>> 1 byte
>> 1 byte
>> 1 byte
>> short
>> 2 bytes
>> 2 bytes
>> 2 bytes
>> 2 bytes
>> int
>> 4 bytes
>> 4 bytes
>> 4 bytes
>> 4 bytes
>> long
>> 4 bytes
>> 4 bytes
>> 8 bytes
>> 8 bytes
>> pointer
>> 4 bytes
>> 4 bytes
>> 8 bytes
>> 8 bytes
>> size_t
>> 4 bytes
>> 4 bytes
>> 8 bytes
>> 8 bytes
>> long long
>> 8 bytes
>> 4 bytes
>> 8 bytes
>> 8 bytes
>> fpos_t
>> 8 bytes
>> 4 bytes
>> 8 bytes
>> 8 bytes
>> off_t
>> 8 bytes
>> 4 bytes
>> 8 bytes
>> 8 bytes
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://lists.apple.com/archives/xcode-users/attachments/20140912/ea73074a/attachment.html>
>
> ------------------------------
>
> _______________________________________________
> Xcode-users mailing list
> email@hidden
> https://lists.apple.com/mailman/listinfo/xcode-users
>
> End of Xcode-users Digest, Vol 11, Issue 303
> ********************************************

 _______________________________________________
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


  • Prev by Date: Re: Implicit conversion loses integer precision in x86_64
  • Next by Date: Re: Xcode stalls, no UI, for first 5 minutes of first launch
  • Previous by thread: Re: Implicit conversion loses integer precision in x86_64
  • Next by thread: Adding Swift-bridging hints in Obj-C headers?
  • Index(es):
    • Date
    • Thread