Re: Displaying a number with Quartz
Re: Displaying a number with Quartz
- Subject: Re: Displaying a number with Quartz
- From: "Sean McBride" <email@hidden>
- Date: Tue, 26 May 2009 11:29:36 -0400
- Organization: Rogue Research Inc.
On 5/26/09 5:12 PM, Alexander Spohr said:
>> Never ever use sprintf for anything.
>
>If you use "%d" and know it will be an int? You know how many chars
>you'll have at max, no buffer-overflow possible. (You might argue
>here, that at some time we will habe 128-bit ints, but hey you should
>recode your app then anyway or just have a buffer large enough to
>handle that right at the start)
>
>And yes - you are right, use snprintf instead... int might become 256
>bit.
You can use sprintf safely if you're very careful, I suppose, but using
snprintf is not harder and so much safer. sprintf is just not worth the risk.
--
____________________________________________________________
Sean McBride, B. Eng email@hidden
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
_______________________________________________
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