Without a suffix, a literal with a decimal in it (123.0) will be treated as a double-precision floating-point number. If you assign or pass that to a single-precision variable or parameter, the compiler will (should) issue a warning. Appending f tells the compiler you want the literal to be treated as a single-precision floating-point number.
On Oct 11, 2010, at 23:58:47, Tharindu Madushanka wrote: > Hi, > > I would like to clarify about the usage of .f suffix when using floating > point numbers related to iPhone. I read .f is to tell the compiler about the > number is a float at start avoid any casting. > > So when we use CGRectMake(CGFloat x, CGFloat y, CGFloat width, CGFloat > height) I usually see people use without .f. > > For example, CGRectMake(0,0,320,460) instead of > CGRectMake(0.0f,0.0f,320.0f,460.0f) > > Is there any minor performance of using either approach. Could someone > kindly clarify on this. > > Thanks and Kind Regards, > > Tharindu Madushanka. > _______________________________________________ > > 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/rmann%40latencyzero.com > > This email sent to [email protected] _______________________________________________ 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]
