Portablity using structures and malloc - Help

M.J.Shannon mjs at eagle.UUCP
Fri Jul 19 03:22:55 AEST 1985


> No first time guessers please!  I need help.
> 
> I've really been wondering about the way in which the UNIX 'C' compiler
> handles structures and memory allocation across processors.
> 

The compilers produced by AT&T pad structures as necessary to deal properly
with alignment of members.  The only guarantee made about structure members is
that the (lexically) N+1th member will have an address larger than the Nth
member.  Further, malloc() returns a pointer suitable to be cast to the most
strictly aligned aggregate, so you shouldn't be experiencing any problems (from
the compiler at least).  What problem are you experiencing?
-- 
	Marty Shannon
UUCP:	ihnp4!eagle!mjs
Phone:	+1 201 522 6063



More information about the Comp.unix mailing list