www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/16/16:20:28

To: djgpp AT delorie DOT com
Subject: Re: [Q] malloc() and assumptions about alignment
Message-ID: <19970216.130542.8487.1.chambersb@juno.com>
References: <5dvv1h$ar9 AT news DOT service DOT uci DOT edu>
From: chambersb AT juno DOT com (Benjamin D Chambers)
Date: Sun, 16 Feb 1997 16:03:30 EST

On 13 Feb 1997 20:54:09 GMT beppu AT rigel DOT oac DOT uci DOT edu (John Beppu) writes:
>
>  question 1	Is it safe to assume that memory allocated with
>		malloc() will be aligned on at least a 4 byte
>		boundary.  (using djgpp)
If I had to guess, I'd say yes - but guessing is dangerous.  It's easy to
check the lower 2 bits to find out, though.

>
>  question 2	Is it safe to assume the above will be true of
>		ports of gcc to other platforms?
Other platforms would (presumably) have different penalties for different
alignments, so imposing the Intel alignment on them makes no sense.

>
>  question 3	...and what about other non-gcc compilers?
As in, Borland or MS?  I wouldn't assume anything about them.

...Chambers

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019