[comp.sys.mac.programmer] Think C, MacHeaders, and 'Require prototypes'?

leipold@eplrx7.uucp (Walt Leipold) (01/05/91)

I've run into a problem with Think C 4.  When using the 'require
prototypes' flag, I found some functions (e.g., GetItemMark, SetItemMark,
ParamText, ...) whose arguments did not get coerced properly.  Digging a
little deeper, I found that these functions had no prototypes in *any* of
the .h files in the "Mac #includes" folder.  However, the compiler didn't
complain about missing prototypes, so the precompiled MacHeaders must know
something about these functions.  Is MacHeaders more than the sum of its
parts?  Or is there some set of functions for which the compiler ignores
the 'require prototypes' flag?

--------------------------------------------------------------------------
"When dealing with the insane,                                Walt Leipold
it is best to pretend to be sane."              (leipolw%esvax@dupont.com)
--------------------------------------------------------------------------
--
The UUCP Mailer

phils@chaos.cs.brandeis.edu (Phil Shapiro) (01/08/91)

In article <1991Jan4.212725.13050@eplrx7.uucp> leipold@eplrx7.uucp (Walt Leipold) writes:
   [...] I found some functions (e.g., GetItemMark, SetItemMark,
   ParamText, ...) whose arguments did not get coerced properly.
   Digging a little deeper, I found that these functions had no
   prototypes in *any* of the .h files in the "Mac #includes" folder.
   However, the compiler didn't complain about missing prototypes, so
   the precompiled MacHeaders must know something about these
   functions.  Is MacHeaders more than the sum of its parts?  Or is
   there some set of functions for which the compiler ignores the
   'require prototypes' flag?

THINK C has all (or almost all) of IM I-V built inside it.  There's a
resource (called 'TRAP') that contains the pertinent information about
every Toolbox and OS Trap, including argument and return value size.
Note that traps that require glue (OS and [Not in ROM]) are also in
MacTraps.  These routines are ignored by the "Require Prototypes"
checker.

This allows compilation to proceed much faster.  If you want all of IM
I-V prototyped, then you can ftp "MacProtos.h" from sumex-aim, and
include that in your MacHeaders file.  You may notice that some traps
are prototyped in ThC's headers, this is only for traps that have
non-integral (non 16 bit) return values.

	-phil
--
	   Phil Shapiro                           Technical Support Analyst
	   Language Products Group                     Symantec Corporation
		Internet: phils@chaos.cs.brandeis.edu

-- 
	   Phil Shapiro                           Technical Support Analyst
	   Language Products Group                     Symantec Corporation
		Internet: phils@chaos.cs.brandeis.edu