From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id TAA24424; Thu, 8 Nov 2001 19:12:32 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id TAA24483 for ; Thu, 8 Nov 2001 19:12:31 +0100 (MET) Received: from kiste.thiemo.net (kiste.thiemo.net [193.159.181.84]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id fA8ICRX02744 for ; Thu, 8 Nov 2001 19:12:28 +0100 (MET) Received: (from jc@localhost) by kiste.thiemo.net (8.9.3/8.9.3) id TAA37250; Thu, 8 Nov 2001 19:12:24 +0100 (CET) (envelope-from jc@joerch.org) Date: Thu, 8 Nov 2001 19:12:24 +0100 (CET) Message-Id: <200111081812.TAA37250@kiste.thiemo.net> From: Joerg Czeranski MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit To: ohl@hep.tu-darmstadt.de Subject: Re: [Caml-list] Re: complex bigarrays Cc: caml-list@inria.fr In-Reply-To: <15338.51001.121416.677202@heplix4.ikp.physik.tu-darmstadt.de> Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Thu, 8 Nov 2001 18:56:09 +0100 Thorsten Ohl wrote: > shiv@mac.com 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. regards, jörch ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr