This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Alignment Guarantees?
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: noloader at gmail dot com
- Cc: GCC Users List <gcc-help at gcc dot gnu dot org>
- Date: Mon, 5 Mar 2012 09:49:36 +0000
- Subject: Re: Alignment Guarantees?
- Authentication-results: mr.google.com; spf=pass (google.com: domain of jwakely.gcc@gmail.com designates 10.152.113.136 as permitted sender) smtp.mail=jwakely.gcc@gmail.com; dkim=pass header.i=jwakely.gcc@gmail.com
- References: <CAH8yC8nNyVwoWAgKJ1FRYZZe8bKO8Zep1cQt+sZzNz3oVuh5iw@mail.gmail.com>
On 5 March 2012 06:04, Jeffrey Walton wrote:
> Does C/C++ or GCC offer any alignment guarantees?
Alignment requirements are implementation-defined, usually imposed by
the hardware.
C++ and GCC guarantee that data you declare or dynamically allocate
will be correctly aligned, they don't guarantee that playing tricks
with casts will produce correctly aligned data, whether that works
depends on the hardware.