Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rochester!ur-tut!timd From: timd@ur-tut.UUCP (Tim D'Ascoli) Newsgroups: net.micro.mac Subject: Consulair's Mac C compiler Message-ID: <605@ur-tut.UUCP> Date: Mon, 18-Aug-86 11:37:13 EDT Article-I.D.: ur-tut.605 Posted: Mon Aug 18 11:37:13 1986 Date-Received: Tue, 19-Aug-86 21:02:47 EDT Distribution: net Organization: Univ. of Rochester Computing Center Lines: 46 I hope that this posting will help someone avoid the "extra" debug time that i had to spend when i was using Consulair's Mac C compiler. In The Bible (K & R) on page 94 the following quote can be found, "In short, any array and index expression can be written as a pointer and offset, and vice versa, even in the same statement.", (5:3:6 -- chapter, verse, and paragraph). My problem came with the following code segment: /* declared as a global variable */ char **inputBuffer; /* and then subsequently referenced in another file */ extern char *inputBuffer[]; /* the following variable was also declared in that file ** as a local */ char *inputArray; /* and then de-referencing the global in that file */ inputArray = *inputBuffer; Where this inputArray variable pointed to was not where i had intended, and when i investigated further i found that when the global variable is declared as it was above (extern char *inputBuffer[];) the de-referencing generates a LEA.L (load effective address) call. However, when the extern declaration is done using the "star star" format (i.e. extern char **inputBuffer;), and the de-reference line left unchanged, the code generated is a MOVEA.L (move effective address) which gave me what i had expected from the de-referencing in the first place. Another interesting fact about the Consulair Mac C compiler is that it generates self modifying code (that may not make a migration to a 68020 machine). I found this when i used some of the PBxxxx() calls for file i/o. (The location of the trap is AND'ed with a constant to produce the desired PB trap call). posted in an effort to help. - timd