linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: "Daniel." <danielhilst@gmail.com>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: Does __attribute__((__packed__)) aplies to types or variables?
Date: Sat, 24 Oct 2015 02:52:32 +0200	[thread overview]
Message-ID: <20151024005130.8643C214AA@mail.nwl.cc> (raw)
In-Reply-To: <CAF3SDA4G2YGNOOOSeQE7JPow62M1NX34SiMv=5KykFb-oO1Exg@mail.gmail.com>

On Thu, Oct 22, 2015 at 02:18:47PM -0200, Daniel. wrote:
> I mean that packed attribute is applied only when allocation is
> implied or can I apply packed
> attribute to struct definitions where no variables are declared?

Yes, it applies to the type.

> struct __attribute__((__packed__)) foo { ... };
> struct foo bar; <--- is this packed?

Compare sizeof(struct foo) with sizeof(bar) to find out yourself.

Cheers, Phil

      reply	other threads:[~2015-10-24  0:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-21 17:56 Does __attribute__((__packed__)) aplies to types or variables? Daniel.
     [not found] ` <CAK7N6vrh05XDwa_nBTmid8QZUU8wgFhm0w=R+aMA9tOugL46Mg@mail.gmail.com>
     [not found]   ` <CAF3SDA7pObzwzk-AzdO38-c45VggTJJpwdNzujAuyMV=eSCc=w@mail.gmail.com>
2015-10-22 16:18     ` Daniel.
2015-10-24  0:52       ` Phil Sutter [this message]

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=20151024005130.8643C214AA@mail.nwl.cc \
    --to=phil@nwl.cc \
    --cc=danielhilst@gmail.com \
    --cc=linux-c-programming@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;
as well as URLs for NNTP newsgroup(s).