William Ahern <> writes:
> Thoughts, comments?
>
> #ifdef HAVE_TYPEOF
>
> /*
> * Can use arbitrary expressions
> */
> #define alignof(t) \
> ((sizeof (t) > 1)? offsetof(struct { char c; typeof(t) x; }, x) : 1)
>
> #else
>
> /*
> * Can only use types
> */
> #define alignof(t) \
> ((sizeof (t) > 1)? offsetof(struct { char c; t x; }, x) : 1)
>
> #endif
I don't see a problem with it, but I don't think the test for
sizeof(t) is necessary:
#define alignof(t) \
offsetof(struct { char c; t x; }, x)
--
Keith Thompson (The_Other_Keith)
kst- <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.