home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!iWarp.intel.com|eff!world!siegel
- From: siegel@world.std.com (Rich Siegel)
- Subject: THINK Pascal Misconceptions (was Re: Summary: THINK Pascal...)
- Message-ID: <Bxy4ty.B84@world.std.com>
- Organization: GCC Technologies
- References: <Bxy2Iz.1w7@news.udel.edu>
- Date: Thu, 19 Nov 1992 04:37:09 GMT
- Lines: 53
-
- In Kurisoto's summary of responses to his problem (one of which is mine)
- he quotes several of his respondents, some of whom provide advice which
- is half-baked at best.
-
- In article <Bxy2Iz.1w7@news.udel.edu> kurisuto@chopin.udel.edu (Sean J. Crist) writes:
- >(Person A wrote)
-
- >> When running in ThinkP these calls are done for you, but when you build the
- >> standalone they aren't. I mean stuff like: InitGraf, InitWindows,
- >> InitDialogs... etc. Look up these calls in InsideMac or in any listing of
- >> a complete Mac program!
-
- Wrong, as has been noted before. UNLESS you place a {$I-} in the
- same file as your main program, THINK Pascal generates code to initialize
- the major ToolBox managers before your main program is executed.
-
- >(Person D wrote)
- >> It might be some pointer or other variable that is not initialised. The
- >> debugger does this automatically.
-
- Wrong. The debugger does not initialize -ANYTHING-. In THINK Pascal
- all globals are initialized to zero, but this happens independent of whether
- you're running under the environment or not.
-
- >(Person E wrote)
- >> TP does several things for you in the runtime environment: local (stack)
- >> vars are initialized to zero; your explicit stack and memory allocations
- >> get set up; there are lots of subtle differences having to do with TP
- >> sitting between you and the system; your code executes in a heap zone
- >> in TP's heap zone; etc.
-
- Mostly wrong. Local variables are not initialized to zero. Either under the
- environment or standalone, local variables, except for arguments passed
- in, will contain whatever random junk happens to be in the portion of
- memory which corresponds to the link frame that you're using.
-
- >(Person F wrote)
- >> The THINK Environment is a bit kinder regarding nil pointers, dereferenced
- >> handles and initial values. Check that you aren't using any variables before
- >> setting them and that all your handles are locked before dereferencing.
-
- Not at all. THINK Pascal does nothing to hide bugs involving improper use
- of NIL or junk pointers, any more than the rest of the system does.
-
- I post the corrections here because I feel that bad advice is worse than
- no advice at all.
-
- R.
- --
- -----------------------------------------------------------------------
- Rich Siegel Internet: siegel@world.std.com
- Software Engineer & Toolsmith
- GCC Technologies
-