On 11 Mar 2004, Paul Eggert wrote:

> Remko Troncon <[EMAIL PROTECTED]> 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)

Doesn't this obtain the default alignment of the type rather than the
required alignment?  The required alignment is the alignment necessary
in order to avoid a segmentation fault.  The default alignment has the
additional consideration of efficiency.

Bob
======================================
Bob Friesenhahn
[EMAIL PROTECTED]
http://www.simplesystems.org/users/bfriesen



Reply via email to