This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: How to stop gcc padding structs???



>> True.  I suppose for maximum portability I should just use
>> pointer arithmatic with hard-wired offsets.  It's just so ugly.
>
>Which of course will not work so well if your device is put into a non-x86
or
>non-ppc that traps when given an unaligned pointer (ie, a normal RISC
>machine).

  IOW, for maximum portability, you must memcpy every struct element larger
than a byte into an object of the correct type, then use ntoh(l,s) whatever
to handle endian-ness, and only then reference it.

  And this is in a device driver, and possibly even in an ISR.

  This would be the point at which I would say the break-even line has
been crossed and forget about portability :-)

      DaveK
-- 
The Boulder Pledge: "Under no circumstances will I ever purchase anything 
offered to me as the result of an unsolicited email message. Nor will I 
forward chain letters, petitions, mass mailings, or virus warnings to large 
numbers of others. This is my contribution to the survival of the online
community."


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]