• 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: CGFloat and 64 Bit
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CGFloat and 64 Bit


  • Subject: Re: CGFloat and 64 Bit
  • From: Michael Ash <email@hidden>
  • Date: Mon, 9 Feb 2009 12:41:11 -0500

On Mon, Feb 9, 2009 at 3:33 AM, Jean-Daniel Dupas
<email@hidden> wrote:
>
> Le 9 févr. 09 à 06:37, Rob Keniger a écrit :
>
>>
>> On 08/02/2009, at 9:52 PM, Gerriet M. Denkmann wrote:
>>
>>> When I build a Cocoa Project with 32/64 bit, this line gets a warning:
>>>        NSSize a = NSMakeSize( 11.2, 22.4);
>>> which went away using:
>>>        NSSize a = NSMakeSize( (CGFloat)11.2, (CGFloat)22.4);
>>> Is this the only and correct way to use NSMakeSize() ? Looks kind of
>>> ugly.
>>
>>
>> Try this:
>>
>> NSSize a = NSMakeSize( 11.2f, 22.4f);
>>
>> The "f" suffix is a hint to the compiler that it's a float value.
>
> A very bad idea as it would force usage of float in 64bits applications
> where NSSize expect 64 bits CGFloat.

So? Float converts to double just fine. There are no bad consequences
for passing 11.2f to a function that takes double, aside from an
utterly negligible loss of precision when representing the fractional
part.

Mike
_______________________________________________

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: CGFloat and 64 Bit
      • From: Steve Sisak <email@hidden>
References: 
 >CGFloat and 64 Bit (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: CGFloat and 64 Bit (From: Rob Keniger <email@hidden>)
 >Re: CGFloat and 64 Bit (From: Jean-Daniel Dupas <email@hidden>)

  • Prev by Date: Re: Reading MP3 data into a NSDocument using QTKit, -readFromData:, and QTDataReference
  • Next by Date: Re: Reading MP3 data into a NSDocument using QTKit, -readFromData:, and QTDataReference
  • Previous by thread: Re: CGFloat and 64 Bit
  • Next by thread: Re: CGFloat and 64 Bit
  • Index(es):
    • Date
    • Thread