On Wed, 23 Sep 2009 03:39:23 -0700 (PDT), Chris Idou <idou...@yahoo.com>
said:
>From: Ken Thomases <k...@codeweavers.com>
>
>>Don't test whether you're running on Leopard.
>
>Well I'm thinking of a particular bug on Leopard with MDItemCreate where you
have to choose between your program crashing and leaking memory.

Yes, Ken's advice doesn't make sense to me here. Certainly there will be
situations where you want to use Gestalt to test what system you're running
on.

I've just started the process of updating my various little Tiger-and-before
apps for Snow Leopard. Dealing with the problem of whether to run on Leopard
too has been tricky. I was hoping that setting my deployment target to 10.5
(and base to 10.6) would mean that on Snow Leopard I would magically crash
if the app was destined to crash on Leopard, but no such luck. :) The only
way is to copy the built app over to a Leopard machine, run it there, see
what happens, and then try to figure out what the heck it means. You can
spend hours puzzling over a single line of code (at least, I can). REALbasic
has "remote debugging", e.g. it lets you build and debug on a Mac while the
app (with all its breakpoints etc.) is running on a Windows machine, so you
can test your cross-platform compatibility; it would be really cool if Xcode
had something like that.

Plus of course in addition to systems there are architectures to take
account of. At a point where everything was fine on Snow Leopard, at the
same time, on Leopard I was crashing on startup in 64-bit, running fine in
32-bit, and running very weirdly in Rosetta. It took a while to get that
sorted out.

In the end I used a combination of Gestalt (what system are we running on?)
and #if __ppc__ (what architecture are we building for?) to tweak the app's
behavior as needed.

Of course you *could* just say "This app is Snow Leopard / Intel / 64-bit
only," and save yourself a lot of work. :)

m.

-- 
matt neuburg, phd = m...@tidbits.com, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to