On 9 Feb 2009, at 12:43, Rob Keniger <[email protected]> wrote:


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.

Thanks! Works fine.

One question though: in 64 bit mode CGFloat seems to be a double. So the float 11.2f will be converted to double and then passed to NSMakeSize() thus loosing precision (if 11.2 has no exact float representation). Doesn't matter much in this case, but generally: is there suffix which means float in 32 bit and double in 64 bit?

Kind regards,

Gerriet.

_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to