www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/13/22:54:59

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: [Q] malloc() and assumptions about alignment
Date: Thu, 13 Feb 1997 20:13:59 -0800
Organization: Two pounds of chaos and a pinch of salt
Lines: 31
Message-ID: <3303E687.2AF7@cs.com>
References: <5dvv1h$ar9 AT news DOT service DOT uci DOT edu>
Reply-To: fighteer AT cs DOT com
NNTP-Posting-Host: ppp201.cs.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

John Beppu wrote:
> 
>   question 1    Is it safe to assume that memory allocated with
>                 malloc() will be aligned on at least a 4 byte
>                 boundary.  (using djgpp)

Yes, as long as the standard compilation switches are used.  Take a look
at the gcc docs for more information; or you could just get the library
sources (v2/djlsr201.zip) and peek into 'malloc.c'.  :)

>   question 2    Is it safe to assume the above will be true of
>                 ports of gcc to other platforms?

Probably, but it's best to test it to make sure.

>   question 3    ...and what about other non-gcc compilers?

No, you can't depend on this.

May I ask what it is that you are doing that depends on memory
alignment?

-- 
John M. Aldrich, aka Fighteer I <fighteer AT cs DOT com>

-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS d- s+:- a-->? c++>$ U@>++$ p>+ L>++ E>++ W++ N++ o+>++ K? w(---)
O- M-- V? PS+ PE Y+ PGP- t+(-) 5- X- R+(++) tv+() b+++ DI++ D++ G>++
e(*)>++++ h!() !r !y+()
------END GEEK CODE BLOCK------

- Raw text -


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