Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site ncoast.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!decvax!cwruecmp!atvax!ncoast!bsa From: bsa@ncoast.UUCP (Brandon Allbery) Newsgroups: net.lang.c Subject: Re: type punning Message-ID: <614@ncoast.UUCP> Date: Tue, 26-Feb-85 11:26:45 EST Article-I.D.: ncoast.614 Posted: Tue Feb 26 11:26:45 1985 Date-Received: Fri, 1-Mar-85 07:18:42 EST References: <8132@brl-tgr.ARPA> Reply-To: bsa@ncoast.UUCP (Brandon Allbery) Organization: North Coast Programming, Cleveland Lines: 40 Summary: Since we're on the subject, I'm trying to write a program using my own memory management routines. Basically, only two kinds of objects are allocated: char[] and struct _var { short v_type; char *v_name; char *v_value; struct _var *v_next; } Now, my memory management is to sbrk() when needed, and to put freed (struct _var)'s onto a free-list; freed strings are appended to char *'s (v_value) on the free list, and the size of the string is kept in the then-unused v_type field. The problem is that I may conceivably use up all process memory (this is a Xenix system, not vmunix) in strings on the freelist, stored in a number of unremoveable struct _var's (string sizes near 32767 chars; the most likely scenario is just ONE struct _var), and need a struct _var for some reason. I would like to turn a string into a struct _var. I've already set up a portability file; by using a set of macros bsizeof() and word_size, I can get the sizes fairly portably. But I don't know how to portably align the struct on whatever boundary it needs. Could people on various architectures (VAX/PDP-11, S-1, Honeywell, etc.) please help me by sending me mail on the necessary alignment needed for these structures? With a representative set of architectures, maybe I could set up some kludgey form of alignof() or similar to make this possible. Thanks in advance, Brandon (bsa@ncoast.UUCP) -- Brandon Allbery, decvax!cwruecmp!ncoast!bsa, ncoast!bsa@case.csnet (etc.) 6504 Chestnut Road Independence, Ohio 44131 +1 216 524 1416 -- CIS 74106,1032 -=> Does the Doctor make house calls? <=-