[Aldor-l] alignof

Bill Page bill.page at newsynthesis.org
Fri Mar 21 17:56:27 EDT 2008


On 3/21/08, Pippijn van Steenhoven wrote:
>
>  I keep wondering what to do with this:
>
>  # define alignof(T)             (sizeof(struct {char a; T b;}) - sizeof(T))
>
>  as it's incorrect. When the compiler adds padding to the structure,
> this macro may return a negative value, breaking everything.
>

Can you given an example where this situation occurs?

Is it desirable to include a check and error exit in this macro to
make sure that this is not happening? Can such a test be implemented
without severely impacting the performance of the compiler? If not,
perhaps a "debug" build option is desirable.

Regards,
Bill Page.




More information about the Aldor-l mailing list