Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!maverick.ksu.ksu.edu!unmvax!uokmax!d.cs.okstate.edu!minich From: minich@d.cs.okstate.edu (Robert Minich) Newsgroups: comp.sys.mac.programmer Subject: Re: Lint for Think C Message-ID: <1990Aug16.213123.14437@d.cs.okstate.edu> Date: 16 Aug 90 21:31:23 GMT References: <1990Aug5.195935.16500@phri.nyu.edu> Organization: Oklahoma State University Lines: 31 by roy@alanine.phri.nyu.edu (Roy Smith): | I'm just starting to get into programming on the Mac. I'm using | Think C. What I can't seem to figure out is how to debug programs, | especially when it comes to tracking down pointer mistakes. For example, I | just tracked down a bug resulting from my doing "GlobalToLocal (point)" | instead of "GlobalToLocal (&point)". On a Unix system, lint would have | caught something like that. Think C seems to do some sort of built in type | checking with toolbox routines, but didn't catch this one. Any suggestions | for how to find stuff like that? Use prototypes. THINK C knows the number and size of arguments for the toolbox but will take any types you like. For prototypes of the toolbox calls, ftp to: sumex-aim.standford.edu [36.44.0.6] login:anonymous password: and in info-mac/lang you'll find: macmod info-mac 19748 Sep 16 1989 inside-mac-c-prototypes.hqx and use it for everything. It can head off problems you wouldn't otherwise catch. The only drawback is that you have to do lots of type casting in function calls where you send constants like 0 or -1 or whatever. -- |_ /| | Robert Minich | |\'o.O' | Oklahoma State University| There are no heroes -- |=(___)= | minich@a.cs.okstate.edu | We all wear gray hats. | U | - Ackphtth |