EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  <20042005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  <20042005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Compiler switches on RISC byte alignment
From: Andrew Johnson <[email protected]>
To: "Dalesio, Leo" <[email protected]>
Cc: [email protected]
Date: Wed, 01 Sep 2004 12:23:05 -0500
Dalesio, Leo wrote:
Is there a compiler switch on the GNU compiler to turn off the RISC byte alignment?

Define the specific structure you want with the gcc-specific syntax __attribute__((packed). You do that like this:


struct foo {
  char a;
  short b __attribute__((packed));
  int c __attribute__((packed));
};

I think you can also put the attribute on the structure itself (after the closing {}) to pack all fields together.

Variable attributes in gcc are described here:
http://gcc.gnu.org/onlinedocs/gcc/Type-Attributes.html

HTH,

- Andrew
--
Dear God, I didn't think orange went with purple until I saw
the sunset you made last night.  That was really cool. - Caro


References:
Compiler switches on RISC byte alignment Dalesio, Leo

Navigate by Date:
Prev: Compiler switches on RISC byte alignment Dalesio, Leo
Next: RE: I see the light (with epics) Lawrence T. Hoff
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  <20042005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Compiler switches on RISC byte alignment Dalesio, Leo
Next: RE: Compiler switches on RISC byte alignment Fairley, Diane
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  <20042005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 10 Aug 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·