[Aldor-l] alignof

Gabriel Dos Reis gdr at cs.tamu.edu
Fri Mar 21 20:22:30 EDT 2008


Pippijn van Steenhoven <pip88nl at gmail.com> writes:

| First of all, it is not important whether or not there is an example. The
| compiler is free to add padding to a struct { char a; short b; }; and then the
| code is broken. On x86, it would make sense to align the short to 4 bytes and
| the struct itself, too, leading to an alignof (that struct) of 0. I can
| probably live with it as long as no issues arise. The problem is really just,
| the code is broken and it would be good if a better alternative was found.
| 

It matters that there is a real example, otherwise we would be 
elaborating in the vacuum.. 
All useful C programs I know of rely on some form of implementation
defined or undefined behaviour of the C abstract machine.  That is just
real life.  Even the famous `hello world' program relies on
implementation defined aspects to produce anything useful.

-- Gaby




More information about the Aldor-l mailing list