emb1354@uxf.cso.uiuc.edu (09/25/88)
Hear Hear! This bug was found by myself and a collegue several months ago. The calls we were making to PrGeneral() were returning garbage values and we couldn't figure out why. Come to find the <PrintTraps.h> file was screwed. The funny thing is that such a bug got past everyone in the testing process. What's the deal? BTW, this bug exists in both MPW C 2.0 and 2.0.2 releases. Hmmm. ***************************************************************** * Eric M. Berdahl * "Y'know, there's alot of air" * * PsiWare Software, not inc. * -Robert Miller * * emb1354@uxf.cso.uiuc.edu * * *****************************************************************
earleh@eleazar.dartmouth.edu (Earle R. Horton) (09/26/88)
In article <1234600004@uxf.cso.uiuc.edu> emb1354@uxf.cso.uiuc.edu writes: > >Hear Hear! > > This bug was found by myself and a collegue several months ago. The >calls we were making to PrGeneral() were returning garbage values and we >couldn't figure out why. Come to find the <PrintTraps.h> file was screwed. >The funny thing is that such a bug got past everyone in the testing process. >What's the deal? > The keyword is "int." I was investigating the possibility of compiling an Aztec C program which uses the ToolBox using 32-bit ints. In Aztec, an int is 16 bits unless you tell the compiler that it is 32. If things are defined properly as shorts or longs, or typedef'ed to the right size, then the compiler should have no trouble generating a 32 bit application which uses the ToolBox. I "search"ed for "int" in all of the MPW-compatible header files that came with Aztec, and the Printing.h and PrintTraps.h files were the only ones to come up with a significant number of instances of the word "int." This would have to be changed, then, to use this files with the 32-bit switch. Then I looked at the genuine MPW header files to see what Apple said, and it was also int. Since the two compilers have different sized ints, there must be a problem, says I. The moral is this: When using C to call the ToolBox, the data type "int" is strictly for C internal use. We call the ToolBox with shorts or longs, or with things that we have typedef'ed in a header file to be the right size, but never with "int"s! When you get MPW C 3.0, it might be a good idea to search the header file directory for instances of the word "int," just in case. Earle R. Horton. 23 Fletcher Circle, Hanover, NH 03755 (603) 643-4109 Sorry, no fancy stuff, since this program limits my .signature to three