From: kagel AT quasar DOT bloomberg DOT com Date: Tue, 18 Feb 1997 16:46:06 -0500 Message-Id: <9702182146.AA02177@quasar.bloomberg.com > To: beppu AT rigel DOT oac DOT uci DOT edu Cc: djgpp AT delorie DOT com In-Reply-To: <5dvv1h$ar9@news.service.uci.edu> (beppu@rigel.oac.uci.edu) Subject: Re: [Q] malloc() and assumptions about alignment Reply-To: kagel AT dg1 DOT bloomberg DOT com Errors-To: postmaster AT ns1 From: beppu AT rigel DOT oac DOT uci DOT edu (John Beppu) Newsgroups: comp.os.msdos.djgpp Date: 13 Feb 1997 20:54:09 GMT Organization: University of California, Irvine Lines: 19 Nntp-Posting-Host: rigel.oac.uci.edu Dj-Gateway: from newsgroup comp.os.msdos.djgpp Content-Type: text Content-Length: 421 question 1 Is it safe to assume that memory allocated with malloc() will be aligned on at least a 4 byte boundary. (using djgpp) question 2 Is it safe to assume the above will be true of ports of gcc to other platforms? question 3 ...and what about other non-gcc compilers? [information,opinions] are appreciated. It is safe to assume that any compliant "C" compiler will align malloc() memory blocks to the most restrictive requirements of the native, or target, processor. On Intel x86 in real mode this is 2byte alignment, in intel x86 32 bit Protected mode this is 4byte alignment. For Motorola 88xx0 , for example, the alignment is 8byte alignment. -- Art S. Kagel, kagel AT quasar DOT bloomberg DOT com A proverb is no proverb to you 'till life has illustrated it. -- John Keats