Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!rochester!cornell!uw-beaver!mit-eddie!husc6!cmcl2!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.UUCP Newsgroups: comp.lang.c Subject: Re: Arrays of Unknown Length in Structures (and sizeof) Message-ID: <6501@brl-smoke.ARPA> Date: Fri, 2-Oct-87 16:49:29 EDT Article-I.D.: brl-smok.6501 Posted: Fri Oct 2 16:49:29 1987 Date-Received: Sat, 3-Oct-87 09:54:47 EDT References: <243@mit-prep.ARPA> <1044@ius1.cs.cmu.edu> <786@cc5.bbn.com.BBN.COM> <10760@beta.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 12 In article <10760@beta.UUCP> dph@LANL.GOV.ARPA (David P Huelsbeck) writes: >I'm trying to imagine what possible semantics could be associated >with a zero-sized array. An array name is a constant that contains >the starting address of some pre-allocated space in memory. In other >words it's a pointer constant. What value could the compiler assign >that would point to zero pre-allocated memory locations? NULL? There isn't any problem, really. The compiler can allocate a location for the 0-sized object. The tricky part is that it should probably skip at least one byte before allocating the next object anyway, so that all distinct objects have distinct addresses. I think this consideration is what killed the proposal for malloc(0).