Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!uwm.edu!ux1.cso.uiuc.edu!resnick From: resnick@cogsci.uiuc.edu (Pete Resnick) Newsgroups: comp.sys.mac.programmer Subject: Re: Testing for System 7 Message-ID: <1991Jul1.025240.29145@ux1.cso.uiuc.edu> Date: 1 Jul 91 02:52:40 GMT References: <54449@apple.Apple.COM> <1991Jun29.040825.12123@ux1.cso.uiuc.edu> <54492@apple.Apple.COM> Sender: usenet@ux1.cso.uiuc.edu (News) Distribution: na Organization: University of Illinois at Urbana Lines: 40 keith@Apple.COM (Keith Rollin) writes: >In article <1991Jun29.040825.12123@ux1.cso.uiuc.edu> resnick@cogsci.uiuc.edu (Pete Resnick) writes: >>davids@mondo.engin.umich.edu (David Snearline) writes: >> >>>Except that you would have to check the version of the system to see >>>if _Gestalt exists... :-) >> >>No, no, no. Very bad. Check for the existence of the _Gestalt trap >>by looking to see if it is in the trap table using NGetTrapAddress. You >>*never* need to look at the version number of the operating system. >> >No, no, no. Very bad. Check for the existance of Gestalt by looking >at the version number of your development system. Gestalt is _glue_; >it's in the libraries of the most recent development systems. You >don't have to check for a Gestalt trap. Just call it. If the trap >exists, the library routine will call it. If not, then the library >routine emulates it as well as it can. Well, according to Inside Mac VI, p. 3-32 to 3-33, the *proper* way to do it is to look for the trap. Now, granted, some development environments may implement Gestalt as glue, and people should use that if they can (so their software is portable to operating systems before 6.0.4), but that means that your development environment is giving you an extra piece of code to use. It does not mean that you should look at the *operating system* version number, or even that you can depend on the glue being available unless your development manufacturer documents that they have such a thing. "Just call it" is *not* IMHO good advice. I stand by my original statement: The proper way to determine if Gestalt is avaiable is to check to see if the trap is available and not to look at the operating system version number. pr -- Pete Resnick (...so what is a mojo, and why would one be rising?) Graduate assistant - Philosophy Department, Gregory Hall, UIUC System manager - Cognitive Science Group, Beckman Institute, UIUC Internet/ARPAnet/EDUnet : resnick@cogsci.uiuc.edu BITNET (if no other way) : FREE0285@UIUCVMD