home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / sys / mac / programm / 18633 < prev    next >
Encoding:
Text File  |  1992-11-18  |  2.7 KB  |  64 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!iWarp.intel.com|eff!world!siegel
  3. From: siegel@world.std.com (Rich Siegel)
  4. Subject: THINK Pascal Misconceptions (was Re: Summary: THINK Pascal...)
  5. Message-ID: <Bxy4ty.B84@world.std.com>
  6. Organization: GCC Technologies
  7. References: <Bxy2Iz.1w7@news.udel.edu>
  8. Date: Thu, 19 Nov 1992 04:37:09 GMT
  9. Lines: 53
  10.  
  11. In Kurisoto's summary of responses to his problem (one of which is mine)
  12. he quotes several of his respondents, some of whom provide advice which
  13. is half-baked at best.
  14.  
  15. In article <Bxy2Iz.1w7@news.udel.edu> kurisuto@chopin.udel.edu (Sean J. Crist) writes:
  16. >(Person A wrote)
  17.  
  18. >> When running in ThinkP these calls are done for you, but when you build the
  19. >> standalone they aren't.  I mean stuff like:  InitGraf, InitWindows,
  20. >> InitDialogs... etc.  Look up these calls in InsideMac or in any listing of
  21. >> a complete Mac program!
  22.  
  23.     Wrong, as has been noted before. UNLESS you place a {$I-} in the
  24. same file as your main program, THINK Pascal generates code to initialize
  25. the major ToolBox managers before your main program is executed.
  26.  
  27. >(Person D wrote)
  28. >> It might be some pointer or other variable that is not initialised. The
  29. >> debugger does this automatically.
  30.  
  31.     Wrong. The debugger does not initialize -ANYTHING-. In THINK Pascal
  32. all globals are initialized to zero, but this happens independent of whether
  33. you're running under the environment or not.
  34.  
  35. >(Person E wrote)
  36. >> TP does several things for you in the runtime environment: local (stack)
  37. >> vars are initialized to zero; your explicit stack and memory allocations
  38. >> get set up; there are lots of subtle differences having to do with TP
  39. >> sitting between you and the system; your code executes in a heap zone
  40. >> in TP's heap zone; etc.
  41.  
  42. Mostly wrong. Local variables are not initialized to zero. Either under the
  43. environment or standalone, local variables, except for arguments passed
  44. in, will contain whatever random junk happens to be in the portion of
  45. memory which corresponds to the link frame that you're using.
  46.  
  47. >(Person F wrote)
  48. >> The THINK Environment is a bit kinder regarding nil pointers, dereferenced
  49. >> handles and initial values. Check that you aren't using any variables before
  50. >> setting them and that all your handles are locked before dereferencing.
  51.  
  52. Not at all. THINK Pascal does nothing to hide bugs involving improper use
  53. of NIL or junk pointers, any more than the rest of the system does.
  54.  
  55. I post the corrections here because I feel that bad advice is worse than
  56. no advice at all.
  57.  
  58. R.
  59. -- 
  60. -----------------------------------------------------------------------
  61. Rich Siegel                              Internet: siegel@world.std.com
  62. Software Engineer & Toolsmith
  63. GCC Technologies
  64.