Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!lanl!lambda!jlg From: jlg@lambda.UUCP (Jim Giles) Newsgroups: comp.lang.c Subject: Re: NOT Educating FORTRAN programmers to use C Message-ID: <14196@lambda.UUCP> Date: 17 Jan 90 00:45:47 GMT References: <651@chem.ucsd.EDU> Distribution: na Lines: 35 From article <651@chem.ucsd.EDU>, by tps@chem.ucsd.edu (Tom Stockfisch): > subroutine sub( a, m ) > double precision a(m) > ... > end > program > real r(5) > double precision d1(2), d2(2) > equivalence ( d1(1), r(1) ), ( d2(1), r(2) ) > C d1() and d2() can't both be aligned on an 8 byte boundary > call sub( d1, 2 ) > call sub( d2, 2 ) > end As I said before, whichever double was odd-aligned would receive a warning message. Most users regard such a problem as a mistake on their part. The only implementation I've seen where there was any debate on this issue was one where the subroutine was always compiled to generate the slow references. By popular demand from the users, this implementation was changed to always use the fast references for double. This required the implementor to issue a fatal for the subroutine call which was mis-aligned. I don't know anyone who complained about this (in spite of the fact that it was, strictly speaking, non-standard). By the way, both Fortran and C exhibit this same problem for character data types. Neither language requires characters to be word aligned, and so, on word addressed machines, the compiler must generate lond sequences of code to fetch/store character arguments. Contrary to the above experience, I suspect _most_ users would complain if characters had to be word aligned. Further, I suspect they would also complain if forced to use you 'unaligned' attribute in their declarations. J. Giles