From: Steve French <smfltc@us.ibm.com>
To: linux-kernel@vger.kernel.org
Subject: one pragma pack vs. many, many __attribute__((packed))
Date: 27 Oct 2005 14:42:55 -0500 [thread overview]
Message-ID: <1130442175.26176.25.camel@stevef95.austin.ibm.com> (raw)
Seems like a big annoyance, but gcc on some platforms (arm) will
generate different code for
pragma pack(1)
vis the corresponding more verbose alternative ie specifying
__attribute__((packed))
on each structure one by one. Presumably there are good reasons for why
packing them across the whole file does not mean you can necessarily
read them when they aren't aligned (my imagination is not that good)
Although it makes the code more verbose to individually call out packing
on each structure, I don't see any reasonable alternative that would
work (at least on arm) as I have to deal with structures coming in off
the network that are packed - and in some cases not aligned on 2 or 4
byte boundaries either. special case parsing them off the wire (as
opposed to accessing them with their structure field names) would be
worse, and copying them into a temp buffer would be worse ... are there
no reasonable magic compile options or pragmas that will have the effect
of attribute__((packed)) without being so verbose?
reply other threads:[~2005-10-27 19:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1130442175.26176.25.camel@stevef95.austin.ibm.com \
--to=smfltc@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®