Path: utzoo!attcan!uunet!cs.utexas.edu!uwm.edu!bbn.com!nic!chaos.cs.brandeis.edu!chaos!phils From: phils@chaos.cs.brandeis.edu (Phil Shapiro) Newsgroups: comp.sys.mac.programmer Subject: Re: MacProtos.h Message-ID: Date: 16 Oct 90 14:19:35 GMT References: <15187@hydra.gatech.EDU> Sender: @chaos.cs.brandeis.edu Organization: Symantec Corp. Lines: 32 In-Reply-To: gt0657c@prism.gatech.EDU's message of 15 Oct 90 06:20:14 GMT In article <15187@hydra.gatech.EDU> gt0657c@prism.gatech.EDU (geoff george) writes: In trying to call FillRect(), I passed it the global "white" and it complained. Think C 4's gives: typedef unsigned char Pattern[8]; extern Pattern white; which makes "white" a "char *". MacProtos.h gives: pascal void FillRect(Rect *r, Pattern *pat); which makes pat a "char * *" or "char * []". I believe that second parameter should be "Pattern pat", not "*pat". In C, an array name is synonymous with its address when used as a parameter. Therefore, FillRect(&r, &white) and FillRect(&r, white) are (in terms of C) equally correct, since they are semantically equivalent. So, why did the creators of MacProto decide to use "Pattern *"? The User's Manual for C says that arguments to toolbox functions that are larger than 4 bytes must be passed by address. Since sizeof(Pattern) == 16, they chose to use the Pattern's address. Out of curiousity, how widely _is_ MacProtos.h used? As I said, I personally love it, since it gives me a little more type checking that Think C has built in for Mac traps. I don't know how widely it's used -- but I use it all the time. -phil -- Phil Shapiro Technical Support Analyst Language Products Group Symantec Corporation Internet: phils@chaos.cs.brandeis.edu