delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/02/09/09:41:47

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f
Date: Sat, 09 Feb 2002 16:40:33 +0200
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Sender: halo1 AT zahav DOT net DOT il
To: djgpp-workers AT delorie DOT com
Message-Id: <7704-Sat09Feb2002164033+0200-eliz@is.elta.co.il>
X-Mailer: emacs 21.2.50 (via feedmail 8 I) and Blat ver 1.8.9
In-reply-to: <200202091234.g19CYUV17283@envy.delorie.com> (message from DJ
Delorie on Sat, 9 Feb 2002 07:34:30 -0500)
Subject: Re: Alignment problem
References: <3C629769 DOT AEAFB611 AT cyberoptics DOT com> <379-Fri08Feb2002101042+0200-eliz AT is DOT elta DOT co DOT il> <200202081420 DOT g18EKWb06863 AT envy DOT delorie DOT com> <7872-Fri08Feb2002203948+0200-eliz AT is DOT elta DOT co DOT il> <200202081853 DOT g18IrgO08699 AT envy DOT delorie DOT com> <9003-Sat09Feb2002090616+0200-eliz AT is DOT elta DOT co DOT il> <200202091234 DOT g19CYUV17283 AT envy DOT delorie DOT com>
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> Date: Sat, 9 Feb 2002 07:34:30 -0500
> From: DJ Delorie <dj AT delorie DOT com>
> 
> Malloc doesn't know the difference between allocating 8 bytes for a
> double, or for 8 chars.  And since you can always realloc a buffer, I
> don't think we can rely on the size of the allocation to determine
> what kinds of data types will be used with it.

Then perhaps we should always align on 8-byte boundary; GCC already
does that for the stack.  Since malloc rounds the allocation size to
an integral multiple of 8, it sounds like making sure every allocation
is 8-byte aligned should boil down to forcing a suitable alignment of
the beginning of every contiguous chunk returned by sbrk.

- Raw text -


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