This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: __alignof__(void)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]