[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Checking alignment of data types
From: |
Paul Eggert |
Subject: |
Re: Checking alignment of data types |
Date: |
11 Mar 2004 11:03:23 -0800 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 |
Remko Troncon <address@hidden> writes:
> Is there a predefined autoconf macro to retrieve the required alignment of
> data types ?
No. It's not needed all that much, since you can find the alignment
of a type in C.
#include <stddef.h>
#define alignof(type) offsetof (struct { char x; type y; }, y)
It wouldn't be hard to add an AC_CHECK_ALIGNOF macro, which would work
like AC_CHECK_SIZEOF. The only real advantage of this would be that
you could use the alignments in #if expressions.