• 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: Float constants
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Float constants


  • Subject: Re: Float constants
  • From: Manfred Schwind <email@hidden>
  • Date: Thu, 18 Mar 2010 15:22:55 +0100

> Still, CGFloat is a pain when using the 64 to 32 bit truncation warning
> and doing something like:
>
> NSRect foo = NSMakeRect (1.0, 2.0, ...)
>
> it will warn building as 32 bit since it's implicitly converting double
> to float.  You could do:
>
> NSRect foo = NSMakeRect ((CGFloat)1.0, (CGFloat)2.0, ...)
>
> But that's too ugly IMHO.  My solution is:
>
> NSRect foo = NSMakeRect (1.0f, 2.0f, ...)
>
> which has no warnings in 32 nor 64.  It would be nice if we could write
> something like:
>
> NSRect foo = NSMakeRect (1.0cg, 2.0cg, ...)

You can do it e.g. this way:

#define CGF(x) ((CGFloat)(x))
...
NSRect foo = NSMakeRect (CGF(1), CGF(2), CGF(4.5), ...)

Mani
--
http://mani.de - friendly software
iVolume - listen to music hands-free
LittleSecrets - the encrypted notepad
Sahara - sand in your pocket
Watchdog - baffle the curious

_______________________________________________

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

References: 
 >Float constants (From: Michael Vannorsdel <email@hidden>)
 >Re: Float constants (From: "Sean McBride" <email@hidden>)

  • Prev by Date: Detecting if you're being debugged
  • Next by Date: Re: NSBrowser and tab order
  • Previous by thread: Re: Float constants
  • Next by thread: Suppressing autocomplete on space
  • Index(es):
    • Date
    • Thread