Path: utzoo!utgpu!water!watmath!clyde!att!ihlpb!tainter From: tainter@ihlpb.ATT.COM (Tainter) Newsgroups: comp.lang.c Subject: Re: Multidimensional Static Array Initialization Follow-up Message-ID: <8584@ihlpb.ATT.COM> Date: 22 Aug 88 17:35:25 GMT References: <2682@jpl-devvax.JPL.NASA.GOV> <13060@mimsy.UUCP> Organization: AT&T Bell Laboratories - Naperville, Illinois Lines: 24 In article <13060@mimsy.UUCP>, chris@mimsy.UUCP (Chris Torek) writes: > In article <2682@jpl-devvax.JPL.NASA.GOV> timg@jpl-devvax.JPL.NASA.GOV >(Tim Graham) writes: >>For example ... >> int foo[][4] = { { 1, 2, 3, 4 }, { 5, 8 }, { 9, 10, 12 } }; >>... the uninitialized elements in the 3x4 array are filled with zeros. Is >>it really that much harder for it to be possible to implement >> int foo[][] = { { 1, 2, 3, 4 }, { 5, 8 }, { 9, 10, 12 } }; > Yes. Consider the situation from the compiler's point of view, > and in particular, the case where the first row is not the longest: > In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) > Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris It isn't just an issue of the initializer. Consider code referencing the above entity foo. As long as only one dimension is unknown C can generate code to manipulate the structure without requiring patching at link time. Note: Defering the resolution of this type of symbol would probably complicate using an assembler as a back end for the c ompiler. --j.a.tainter ihlpb!tainter