home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / mac / programm / 13938 < prev    next >
Encoding:
Text File  |  1992-08-13  |  2.5 KB  |  58 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!mcsun!sunic!kth.se!dront.nada.kth.se!d88-jwa
  3. From: d88-jwa@dront.nada.kth.se (Jon W{tte)
  4. Subject: Re: Help!  System error #28
  5. In-Reply-To: chuck@gte.com's message of 13 Aug 92 12:49:44 GMT
  6. Message-ID: <D88-JWA.92Aug13162902@dront.nada.kth.se>
  7. Followup-To: comp.sys.mac.programmer
  8. Originator: d88-jwa@dront.nada.kth.se
  9. Sender: usenet@kth.se (Usenet)
  10. Nntp-Posting-Host: dront.nada.kth.se
  11. Organization: Royal Institute of Technology, Stockholm, Sweden
  12. References: <chuck-120892123052@choffman.gte.com> <chuck-130892084411@choffman.gte.com>
  13. Date: Thu, 13 Aug 1992 15:29:02 GMT
  14. Lines: 42
  15.  
  16. > chuck@gte.com (Chuck Hoffman) writes:
  17.  
  18.    The problem turned out to be a dumb error masquerading as a memory
  19.    management problem, though.  I had passed an int to FSRead for the number
  20.    of bytes to read.  It was expecting a long, so FSRead thought the few bytes
  21.  
  22.    This kind of problem would have been much easier to debug at the assembly
  23.    level with MacsBug, rather than at the source level with THINK C Debugger. 
  24.    I'm a very experienced programmer using IBM System/370 Assembly Language
  25.  
  26. It would be even easier to avoid by having the compiler catch
  27. the error.
  28.  
  29. If you use MPW, turn on all warnings. If you use Think C,
  30. follow these simple steps:
  31.  
  32.     1) Turn on "prototype enforcement" and "require prototypes"
  33.            in the language settings
  34.     2) Turn on "Check pointer types" in the same dialog.
  35.        Be sure to copy options to new projects as well at this point.
  36.     3) Open your "Mac #Includes.c" file in the MacIncludes folder
  37.     4) Change #define SIMPLIFY_PROTOTYPES to 0
  38.     5) While you're at it, turn on ALL of the header files,
  39.        except for the few mentioned in the comment at the start
  40.        of the file.
  41.     6) Choose "Precompile"
  42.     7) Save as MacHeaders, overwriting your previous MacHeaders.
  43.  
  44. This trick will not only catch a LOT of otherwise hard to find bugs,
  45. including the bug you just described, but it will reduce the size of
  46. your project file a lot. If you use the class library, why not include
  47. those headers as well ? A class library project then becomes < 600K in
  48. size !
  49.  
  50. If you don't do this, you're just stupid and ignorant and deserve to
  51. be bitten by all the bugs that find you :-)
  52.  
  53. -- 
  54. - I have decided that it is not boxes but my lack of skill that's the problem.
  55. - Traitor! This kind of attitude will get you nowhere around here. If you must
  56.   know, it's not your boxes that are the problem, it's your lack of a
  57.   sufficient number of boxes. Go out and buy something.
  58.