Simon Marlow wrote:
> [...] Just out of interest, do you know whether doubles *must* be aligned
> on an 8-byte boundary on HP, or is it just a performance thing?
Well, it depends on your definition of "performance": Failing to align
doubles on 8-byte-boundaries on HPs results in highly efficient
core-dump-producers: :-)
------------------------------------------------------------------
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char argv[]) {
struct { int x, y, z; } bar;
int py = (int)(&(bar.y));
double *pd = (double*)(&(bar.y));
(void)argc; (void)argv; /* shut up, -Wall! :-) */
/* just to make sure... */
printf("%x\n", py);
if (!((py % 8) == 4)) abort();
*pd = 42.0;
printf("%f\n", *pd);
return 0;
}
------------------------------------------------------------------
panne@tetiaroa:/tmp > ./a.out
7b03a854
Bus error (core dumped)
------------------------------------------------------------------
--
Sven Panne Tel.: +49/89/2178-2235
LMU, Institut fuer Informatik FAX : +49/89/2178-2211
LFE Programmier- und Modellierungssprachen Oettingenstr. 67
mailto:[EMAIL PROTECTED] D-80538 Muenchen
http://www.pms.informatik.uni-muenchen.de/mitarbeiter/panne