On alignment

Gabriel Dos Reis gdr@integrable-solutions.net
Thu May 8 09:58:00 GMT 2003


Jason Merrill <jason@redhat.com> writes:

| On 02 May 2003 15:07:54 +0200, Gabriel Dos Reis <gdr@integrable-solutions.net> wrote:
| 
| > Tom Tromey <tromey@redhat.com> writes:
| >
| > [...]
| >
| > | What will eventually go wrong with what we have now?
| > | 
| > |     template<typename T>
| > |     struct aligner
| > |     {
| > |       T field;
| > |     };
| > | 
| > |     #define ALIGNOF(TYPE) (__alignof__ (((aligner<TYPE> *) 0)->field))
| >
| > This, as I understand it from my previous attempt, won't give you the
| > right answer (for double, it would give 8 instead of 4).
| 
| It will give you the right answer on the trunk (and I just checked in a
| patch so it will give you the right answer in 3.3 as well).

OK, many thanks.

-- Gaby



More information about the Gcc mailing list