Mail Archives: djgpp-workers/1999/08/07/14:08:34
In a thread from djgpp AT delorie DOT com
Eli Zaretskii wrote:
>
> On Thu, 5 Aug 1999, Duncan Coutts wrote:
> > Dynamic storage seems the only other possibility.
> > The new operator aligns allocations to 4 byte boundaries.
>
> Are you sure? malloc aligns on 8-byte boundary, so how come new doesn't?
Reminds me that I'd been wondering about implementing `memalign' for
DJGPP. I think it's a BSD invention.
The glibc manual documents it as:
- Function: void * memalign (size_t BOUNDARY, size_t SIZE)
The `memalign' function allocates a block of SIZE bytes whose
address is a multiple of BOUNDARY. The BOUNDARY must be a power
of two! The function `memalign' works by allocating a somewhat
larger block, and then returning an address within the block that
is on the specified boundary.
and also the special case `valloc', where `valloc(n)' ==
`memalign(getpagesize(), n)'.
--
Nate Eldredge
nate AT cartsys DOT com
- Raw text -