Re: Does __attribute__((__packed__)) aplies to types or variables?
Phil Sutter <[email protected]> Sat, 24 Oct 2015 02:52:32 +0200
| Newsgroups | org.kernel.vger.linux-c-programming |
|---|---|
| Message-ID | <[email protected]> |
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