Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site allegra.UUCP Path: utzoo!linus!decvax!genrad!mit-eddie!allegra!jpl From: jpl@allegra.UUCP (John P. Linderman) Newsgroups: net.unix,net.lang.c Subject: Re: Portablity using structures and malloc - Help Message-ID: <4772@allegra.UUCP> Date: Sat, 20-Jul-85 13:21:09 EDT Article-I.D.: allegra.4772 Posted: Sat Jul 20 13:21:09 1985 Date-Received: Sun, 21-Jul-85 22:05:25 EDT References: <81@drux1.UUCP> <907@umcp-cs.UUCP> Organization: AT&T Bell Laboratories, Murray Hill Lines: 19 Xref: linus net.unix:4500 net.lang.c:5171 > The answer is simple: malloc has been written by someone who knows > the hardware alignment constraints of the machine, and it returns > a pointer that is aligned for *any* use. > > In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 4251) malloc knows, but it's a pity that you can't make malloc tell. If there were a nice int malign() {return ALIGNMENT_MULTIPLE;} entry in the malloc package, I could do my own storage allocation out of an area acquired from malloc or elsewhere. [I might want to do this so I could allocate variable-length structures from both ends of an area until the area was filled, something malloc itself cannot be made to do.] A totally trivial one-liner that would make it much easier to write portable software. How about it, system implementors? John P. Linderman The much-maligned allegra!jpl