Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!ucsd!dog.ee.lbl.gov!helios.ee.lbl.gov!ux5.lbl.gov!beard From: beard@ux5.lbl.gov (Patrick C Beard) Newsgroups: comp.sys.mac.programmer Subject: Re: Lint for Think C Message-ID: <6529@helios.ee.lbl.gov> Date: 17 Aug 90 05:00:52 GMT References: <1990Aug5.195935.16500@phri.nyu.edu> <1990Aug16.213123.14437@d.cs.okstate.edu> Sender: usenet@helios.ee.lbl.gov Reply-To: beard@ux5.lbl.gov (Patrick C Beard) Organization: Berkeley Systems, Inc. Lines: 32 X-Local-Date: 16 Aug 90 22:00:52 PDT In article <1990Aug16.213123.14437@d.cs.okstate.edu> minich@d.cs.okstate.edu (Robert Minich) writes: #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. Ah, yes. But even with prototypes for the toolbox, if you aren't careful to prototype all of your own routines, THINK C can still miss things. In fact, even if you do prototype EVERYTHING, THINK C still doesn't warn you about using unitialized variables, and other unsafe usages, nor does it tell you about variables you aren't even using anymore. Use MPW C++! I've passed THINK C objects that were written in a C++ compatible style through MPW C++ and found things I would have never caught in THINK C. Lint should be part of the compiler, not a separate pass. MPW C++ is the closest thing I've seen. It's even good to pass regular C code through it just to get that extra level of type checking (that's why it's so slow :)). -- ------------------------------------------------------------------------------- - Patrick Beard, Macintosh Programmer (beard@lbl.gov) - - Berkeley Systems, Inc. "..............Good day!" - Paul Harvey - -------------------------------------------------------------------------------