Re: Determining system version revisited for Tiger
Re: Determining system version revisited for Tiger
- Subject: Re: Determining system version revisited for Tiger
- From: Bill Cheeseman <email@hidden>
- Date: Sat, 18 Nov 2006 14:29:30 -0500
- Thread-topic: Determining system version revisited for Tiger
on 2006-11-18 1:09 PM, John Stiles at email@hidden wrote:
> Why do you use NSStrings for these comparisons? It looks as if regular
> ints would be fine to me.
Are you suggesting that I return an int from the method instead of returning
a string? Or are you suggesting that I convert the strings to ints before
making a comparison? Either way, wouldn't that require extra steps? I'm not
sure what I would gain, apart from the ability to use C comparison operators
instead of -[NSString compare:].
Returning an int from the method would require an additional processing
step. I use -[NSString stringWithFormat:] for easy zero-padding. At first
glance, to return an int I would tack on an -[NSString intValue] call. Only
one additional step, but still....
To use C comparison operators with strings would require calling -intValue
on each side of the comparison. Otherwise, I would be comparing the strings'
addresses instead of their values.
The main reason I took the string approach, though, is to make it easy for
me to supplement this with methods to format the string for human
readability. Along the lines of the various formats that are allowed for
dates in ISO 8601.
Or have I completely misunderstood your question?
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com
PreFab Software - http://www.prefab.com/scripting.html
The AppleScript Sourcebook - http://www.AppleScriptSourcebook.com
Vermont Recipes - http://www.stepwise.com/Articles/VermontRecipes
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden