Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!bbn!rochester!crowl From: crowl@cs.rochester.edu (Lawrence Crowl) Newsgroups: comp.lang.c Subject: Re: Re: Arrays of Unknown Length in Structures (and sizeof) Message-ID: <3260@sol.ARPA> Date: Thu, 15-Oct-87 13:14:41 EDT Article-I.D.: sol.3260 Posted: Thu Oct 15 13:14:41 1987 Date-Received: Sat, 17-Oct-87 08:48:32 EDT References: <243@mit-prep.ARPA> <1044@ius1.cs.cmu.edu> <668@its63b.ed.ac.uk> <3453@diku.UUCP> <1609@geac.UUCP> Reply-To: crowl@cs.rochester.edu (Lawrence Crowl) Organization: U of Rochester, CS Dept, Rochester, NY Lines: 21 Keywords: structs x.400 unix In article <1609@geac.UUCP> daveb@geac.UUCP (Dave Collier-Brown) writes: >Most of the other examples of variable-sized structs were attempts to save a >pointer-indirection instruction. Since indirections are usually cheap (even >under GCOS), avoidance of them is *not* a win if the price is hard-to-maintain >variable-size struct-munging code. And on many machines (Vax, HW-BULL, >Motorola), the cost of an indirection in space and time works out to less than >the extra calculations for doing anything more than allocating and discarding >the variable-size structs. Variable-size structs are needed in shared memory environments were a data structure can be mapped at many different addresses. For example, consider a shared-memory implementation of a message buffer. It has a fixed size header followed by a variable number of message slots. Because the message buffer may reside at different addresses, the header cannot contain a pointer to the variable number of slots. This could also be solved with relative pointers. To directly support such structures, at least one of the two methods must be provided. -- Lawrence Crowl 716-275-9499 University of Rochester crowl@cs.rochester.edu Computer Science Department ...!{allegra,decvax,rutgers}!rochester!crowl Rochester, New York, 14627