Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!cbmvax!higgin From: higgin@cbmvax.cbm.UUCP (Paul Higginbottom SALES) Newsgroups: comp.sys.amiga Subject: Re: Manx 3.4 bug and sc.c Message-ID: <1896@cbmvax.cbmvax.cbm.UUCP> Date: Tue, 19-May-87 10:23:53 EDT Article-I.D.: cbmvax.1896 Posted: Tue May 19 10:23:53 1987 Date-Received: Wed, 20-May-87 05:31:34 EDT References: <56@f.gp.cs.cmu.edu> Reply-To: higgin@cbmvax.UUCP (Paul Higginbottom SALES) Organization: Commodore Technology, West Chester, PA Lines: 37 In article <56@f.gp.cs.cmu.edu> mjw@f.gp.cs.cmu.edu (Michael Witbrock) writes: $I was using someone's Manx compiler to compile the fractal terraion $generator sc.c (which, incidentally just guru'd when I tried to run it..) $anyway, it has a line $ $short Cell[COUNT][COUNT]; $ $in it (a global). This compiles, but is an undefined symbol at link time. $Changing the line to $ $static short Cell .... $ $fixed this. It fixes the undefined part, but will DEFINITELY cause a crash when running it. $Conclusion: this compiler (at least) does not understand C. That's too sweeping a statement. Like everything, there's a reason for this obscure behavior. If you look more closely at the code, you'll see that COUNT is equal to 1 << SIZE and SIZE is equal to 8. Therefore, COUNT is 256. A 256 x 256 array is 65536 elements (!), and the compiler generates a *16* bit array size for the assembler, and therefore outputs: global _Cell,0 instead of: global _Cell,65536 The assembler, seeing a size of zero, says "hey, if you reserve no space for a variable, that variable doesn't exist", so that's why when you link you get an unresolved reference. My fix was to set SIZE to 7, remove one of the 32's in the table (like it says in the comment), and recompile. This WORKS. Paul. $michael.