(1 / 1)
Date: February 09, 1990 14:54
From: BERT::ALBAUGH
To: @SYS$MAIL:EE
In the process of defining some offsets in an assembly program to reference a structure in 'C', I did a little experiment and was (a bit) surprised. You may be aware of the padding needed when a structure contains elements larger than a byte. What you may not be aware of is that GreenHills (by default) applies that padding even to structures that do _not_ contain any elements larger than a byte. That is, the following C: struct three_byte { char a; char b; char c; } foo[2] = { {1,2,3},{4,5,6} }; will normally produce the following assembly: foo: DC.B 1 DC.B 2 DC.B 3 DCB.B 1,0 ; <- note bogus padding byte DC.B 4 DC.B 5 DC.B 6 DCB.B 1,0 ; <- Yep, another one This has the dual disadvantage of complicating structure passing to GNU CC (which only pads if it should), and increasing the size of your data tables for no good reason. Fortunately, I have since discovered that -x132 will tell the compiler not to do that. Now all I need to do is change my definition of ncc and re-compile all my sources that reference structures with only char elements. Oh well, the devil finds work for idle hands. In case you are interested, I do not (offhand) know of any "US" routines that would be broken by this. Mike
Feb 09, 1990