[parted-devel] Style of __attribute__ ((packed)) and typedef?

Otavio Salvador otavio at debian.org
Wed Feb 14 21:34:17 CET 2007


"Debarshi Ray" <debarshi.ray at gmail.com> writes:

> 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 agree with you. I think we should use the first one. Let's wait for
the others comments. ;-)

-- 
        O T A V I O    S A L V A D O R
---------------------------------------------
 E-mail: otavio at debian.org      UIN: 5906116
 GNU/Linux User: 239058     GPG ID: 49A5F855
 Home Page: http://otavio.ossystems.com.br
---------------------------------------------
"Microsoft sells you Windows ... Linux gives
 you the whole house."



More information about the parted-devel mailing list