public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Grant Edwards <grante@visi.com>
To: ecos-discuss@sources.redhat.com
Subject: [ECOS]  Re: pragma pack
Date: Wed, 09 Jan 2008 23:50:00 -0000	[thread overview]
Message-ID: <fm3mgi$v4$1@ger.gmane.org> (raw)
In-Reply-To: <014701c8530d$ff055940$887ba8c0@PAULD>

On 2008-01-09, Paul D. DeRocco <pderocco@ix.netcom.com> wrote:
>> 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.

The trap snaps shut when you take the address of a field in a
packed struct and pass that to somebody who's expecting a
pointer to a normally aligned value.

-- 
Grant Edwards                   grante             Yow! I am covered with
                                  at               pure vegetable oil and I am
                               visi.com            writing a best seller!


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

  reply	other threads:[~2008-01-09 23:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-09 14:19 [ECOS] " Alexandre
2008-01-09 14:40 ` Andrew Lunn
2008-01-09 14:51 ` Bernard Fouché
2008-01-09 14:56   ` Alexandre
2008-01-09 21:55     ` Bronislav Gabrhelik
2008-01-09 22:22       ` Paul D. DeRocco
2008-01-09 23:50         ` Grant Edwards [this message]
2008-01-10  0:50           ` [ECOS] " Paul D. DeRocco
2008-01-10  9:43             ` Alexandre
2008-01-10 10:07               ` EXTERNAL Gladis Olaf (Praktikant; CR/AEM)
2008-01-10 10:29                 ` Alexandre
2008-01-09 15:02 ` [ECOS] " EXTERNAL Gladis Olaf (Praktikant; CR/AEM)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='fm3mgi$v4$1@ger.gmane.org' \
    --to=grante@visi.com \
    --cc=ecos-discuss@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).