[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Alignment of objects returned by malloc() and operator new()
- Date: Sat, 08 Dec 2007 07:41:32 +1100
- From: chrisj at rtems.org (Chris Johns)
- Subject: Alignment of objects returned by malloc() and operator new()
Robert S. Grimes wrote:
> Quick questions
>
> 1. What are the alignment characteristics of memory returned by malloc()?
>
> 2. What about operator new()?
>
> I need to allocate memory for the Partition Manager, which wants it
> allocated on a 4-byte boundary - need I do anything special?
>
The most portable way is to allocate 4 bytes more and then move the start address.
Regards
Chris