This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: __alignof__(void)
- To: Todd Vierling <tv at pobox dot com>
- Subject: Re: __alignof__(void)
- From: Nathan Sidwell <nathan at acm dot org>
- Date: Wed, 09 Sep 1998 17:52:22 +0100
- CC: egcs at cygnus dot com
- Organization: Computer Science Dept, Bristol University
- References: <Pine.NEB.4.02.9809091218090.12364-100000@duhnet.net>
Todd Vierling wrote:
>
> On Tue, 8 Sep 1998, Nathan Sidwell wrote:
>
> : IMHO a useful value to return would be the maximum alignment for any
> : type.
>
> So how do you determine this `maximum alignment' in a MI fashion?
> This would have to be a MD hack at best.
No, the define BIGGEST_ALIGNMENT already exists to tell gcc this. See
gcc.info-21 for details.
> ...And for LP64 SPARC, it would need to be "16", as doubles are 16-byte
> aligned even though "long long" is only 8 bytes.
For such an ABI, BIGGEST_ALIGNMENT would be (at least) 128. I was just
pointing out the different behaviour on my sparc box.
Having __alignof__(void) tell you this, would allow you to _avoid_ such
hacks to guess a value. On my sparc box, long doubles are indeed 16
bytes, but they are aligned to 8 byte boundaries.
In summary,
1) the knowledge already exists inside gcc
2) this exports that information to user code
3) the current meaning is undocumented/unspecified
nathan
--
Dr Nathan Sidwell :: Computer Science Department :: Bristol University
You can up the bandwidth, but you can't up the speed of light
nathan@acm.org http://www.cs.bris.ac.uk/~nathan/ nathan@cs.bris.ac.uk