COMMONS in C

Seth B Rothenberg rothen at unix.cis.pitt.edu
Mon Mar 19 06:07:28 AEST 1990


I am trying to convert a fortran code-generator into a
C code-generator.  I think I have worked out a scheme for
commons,  but I was recently told something that casts some
doubt on my idea.

I was thinking that a common could be converted into a structure
e.g.,
COMMON TEST /A/B/C/
INTEGER A,B,C

becomes

struct st_com_TEST {
	int A,B,C;
};

extern struct st_com_TEST *com_TEST;

I have actually tried this on the vax and it worked.
But someone told me recently that the order of the variables in 
memory is not always the same as the order of the variables in the 
structure.   Is this true?

Based on the way structures can be initialized, I think the
person I spoke with is mistaken.
I would appreciate any comments.
Thanks
Seth Rothenberg
rothen at unix.cis.pitt.edu



More information about the Comp.lang.c mailing list