Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Re: OCaml speed
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-11-08 (18:12)
From: Joerg Czeranski <jc@j...>
Subject: Re: [Caml-list] Re: complex bigarrays
On Thu, 8 Nov 2001 18:56:09 +0100
Thorsten Ohl <> wrote:
> writes:
> > I have read (some where) that this might cause problems with some C
> > compilers on some machines. That is, if we define struct {float re;
> > float im} A[10]; Then the entries in A may not be packed together as
> > we might expect.
> AFAIK, the C compiler is free to pad structures for better alignment,
> resulting in better performance.  Isn't it even free to reorder
> elements?

No, it isn't.  Order must always be preserved, and no padding is allowed
in front of the first component.

You can always use an array of two elements for each complex:
float A[10][2];  (Or rather typedef float complex_t[2]; complex_t A[10];)
Then the compiler isn't allowed to use any padding.

C99 has introduced complex float, complex double, complex long double,
but I don't think there's a definition of the representation.

Bug reports:  FAQ:
To unsubscribe, mail  Archives: