[ovs-dev] [PATCH] change attribute packed to #pragma pack(push, 1) and pack(pop)

Ben Pfaff blp at nicira.com
Mon Jul 8 21:08:00 UTC 2013


On Mon, Jul 01, 2013 at 10:40:49AM -0700, Linda Sun wrote:
> to allow it to work on non-gnu compiler. 
> 
> 
> Signed-off-by: Linda Sun <lsun at vmware.com> 

This patch won't apply because it is white space damaged.  Please use
"git send-email" or another method that yields correctly formatted
patches.

I do not like this method of handling struct packing.  Please read:
http://stackoverflow.com/questions/1537964/visual-c-equivalent-of-gccs-attribute-packed

The method I prefer on that page is the top-scoring one:

    You can define PACK like this for GNU gcc

    #define PACK( __Declaration__ ) __Declaration__ __attribute__((__packed__))

    and like this for Visual C++:

    #define PACK( __Declaration__ ) __pragma( pack(push, 1) ) __Declaration__ __pragma( pack(pop) )

although I think I would name the macro OVS_PACKED.

Thanks,

Ben.



More information about the dev mailing list