🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #3451

RISC Machine Data Structure Word Alignment Problems?

#3451
From: Doug Toppin X2075
Date: Fri, 19 Jan 1990 23:46
28 lines
1349 bytes
We are using the SUN 4/260 which is a RISC architecture machine.
We are having trouble with data alignment in our data structures.
We have to communicate with external devices that require data structures
such as the following:
	struct
	{
		long  a;
		short b;
		long  c;
	};
When we compile and link something referencing this structure the
data produced appears to have had each element word boundary aligned
so that what results appears to be as follows:
	struct
	{
		long  a;
		short b;
		short pad; <==== this was inserted by cc to align next thing
		long  c;
	};
This means that we lose the benefit of data abstraction and have
to create our own output without using structures.
We have not been able to find any Sun-4 cc option that eliminates
this problem. We cannot use the 'compile as Sun-3' option.
Please let us know if you know of a built-in way around this.
thanks
Doug Toppin
uunet!melpar!toppin
Technical Details
Message-ID: <111@melpar.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!zaphod.mps.ohio-state.edu!samsung!cs.utexas.edu!uunet!melpar!toppin

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!zaphod.mps.ohio-state.edu!samsung!cs.utexas.edu!uunet!melpar!toppin
From: toppin@melpar.UUCP (Doug Toppin   X2075)
Newsgroups: comp.arch,comp.lang.c
Subject: RISC Machine Data Structure Word Alignment Problems?
Keywords: risc sun
Message-ID: <111@melpar.UUCP>
Date: 19 Jan 90 23:46:21 GMT
Organization: E-Systems, Falls Church, VA
Lines: 28