[parted-devel] Style of __attribute__ ((packed)) and typedef?
David Cantrell
dcantrell at redhat.com
Thu Feb 15 17:19:28 CET 2007
On Thu, 2007-02-15 at 01:16 +0530, Debarshi Ray wrote:
> What is the style to be followed while using __attribute__ ((packed))
> and typedef with structures? I find both the following two variants in
> the code:
>
> a. struct __attribute__ ((packed)) _foo {
> ...
> };
> typedef struct _foo foo;
>
> b. typedef struct foo {
> ...
> } __attribute__ ((packed)) foo_t;
>
> Which is the preferred way to do this?
>
> I personally prefer the first one because:
> (i) typedef struct _foo foo; has been followed for most of the major
> structures like PedDisk, PedPartition, etc..
> (ii) Having the __attribute__ in the first line is more readable since
> the information is available immediately. One does not have to scroll
> down to see it.
>
> What are your views?
I prefer (a) because it is more readable.
--
David Cantrell <dcantrell at redhat.com>
Red Hat / Westford, MA
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.alioth.debian.org/pipermail/parted-devel/attachments/20070215/c7fad7ce/attachment-0001.pgp
More information about the parted-devel
mailing list