Re: Float constants
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