This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
RE: pragma pack
- From: "Paul D. DeRocco" <pderocco at ix dot netcom dot com>
- To: <ecos-discuss at ecos dot sourceware dot org>
- Date: Wed, 9 Jan 2008 14:21:35 -0800
- Subject: RE: [ECOS] pragma pack
> From: Bronislav Gabrhelik
>
> Beware of bad alignment of timestamp field. Some processors
> might raise an exception/interrupt when you use the int like
> operation directly on field (including assignment &
> evaluation). You should copy out/in this by memcpy into/from
> temporary variable of the same type when you need to do some
> integer computing on this field. In other case your code
> might not be portable.
I think that's the point of the __packed__ attribute: it forces the compiler
for any machine on which it matters to do the necessary byte
packing/unpacking automagically. I know that's what the Gnu ARM compiler
does.
--
Ciao, Paul D. DeRocco
Paul mailto:pderocco@ix.netcom.com
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss