[comp.sys.mac.programmer] THINK C 4.0 anomaly ?

bordier@imag.imag.fr (Jerome Bordier) (06/27/90)

Here is a piece of program which was well compiled with THINK C 3.0 :
---
Boolean condition;

pascal TPPrDlg	MyJobDlgInit(hPrint)
THPrint	hPrint;
{
...
}

Boolean	My_PrJobDialog()
{
	Boolean value;
	if (condition)	
		value = PrDlgMain(print_record_hdle, &MyJobDlgInit);
	else
		value = PrDlgMain(print_record_hdle, &PrJobInit);
	return value;
}
---
I have added an #include    <PrintTraps.h> to compile with THINK C 4.0
and the compiler refuse "&PrJobInit"  (illegal "adress of" operator).
N.B. PrJobInit is a function in the toolbox.
There is a simple way to fix the problem in this particular case : replace
the second call of PrDlgMain by "PrJobDialog(print_record_hdle);" which do the
same thing (references :Printing Manager and Macintosh Technical Note #95).
Nevertheless the problem seems to be an anomaly in the compiler.

-- 
Jerome BORDIER 	Laboratoire de Structures Discretes et de Didactique
                IMAG B.P. 53 X  38041 GRENOBLE Cedex   FRANCE
TEL: (33) 76 51 45 53  FAX: (33) 76 51 45 55
INTERNET: bordier@imag.Fr       UUCP: bordier@imag (uunet.uu.net!imag!bordier)

minow@mountn.dec.com (Martin Minow) (06/28/90)

In article <10979@imag.imag.fr> bordier@imag.fr (Jerome Bordier) writes:
>		value = PrDlgMain(print_record_hdle, &PrJobInit);
>I have added an #include    <PrintTraps.h> to compile with THINK C 4.0
>and the compiler refuse "&PrJobInit"  (illegal "adress of" operator).
>N.B. PrJobInit is a function in the toolbox.

I suspect (but haven't checked) that PrJobInit is a "Toolbox glue" routine
that is defined as an in-line function (i.e., a piece of assembler
that is inserted in your program) rather than as a normal addressable
routine.  I believe that this capability was added to Think C 4.0.  You
can check by looking at the source of <PrintTraps.h>.

>There is a simple way to fix the problem in this particular case : replace
>the second call of PrDlgMain by "PrJobDialog(print_record_hdle);" which do the
>same thing (references :Printing Manager and Macintosh Technical Note #95).
>Nevertheless the problem seems to be an anomaly in the compiler.

More likely, it's something missing or unclear in the documentation.

Martin Minow
minow@bolt.enet.dec.com