[ovs-dev] [urcu v2 02/15] compiler: New macro for defining aligned structs.

Gurucharan Shetty shettyg at nicira.com
Thu Mar 13 18:35:27 UTC 2014


On Thu, Mar 13, 2014 at 11:22 AM, Ben Pfaff <blp at nicira.com> wrote:
> On Thu, Mar 13, 2014 at 09:57:12AM -0700, Gurucharan Shetty wrote:
>> On Tue, Mar 11, 2014 at 1:56 PM, Ben Pfaff <blp at nicira.com> wrote:
>> > This is broken out into a separate commit because it adds new MSVC
>> > specific code and I don't have MSVC around to test whether it's correct.
>> >
>> > CC: Gurucharan Shetty <gshetty at nicira.com>
>> > Signed-off-by: Ben Pfaff <blp at nicira.com>
>>
>> Looks good to me.
>>
>> I do not see any users of it though.
>>
>> The idea is to do something like this, right?
>>
>> #define OVS_ALIGNED_STRUCT(N, TAG) __declspec(align(N)) struct TAG
>>
>> struct test {
>>     int a;
>>     int b;
>>     char c;
>> };
>> OVS_ALIGNED_STRUCT(64, test);
>
> The comment describes intended use:
>  * e.g. The following:
>  *     OVS_ALIGNED_STRUCT(64, mystruct) { ... };
>  * is equivalent to the following except that it specifies 64-byte alignment:
>  *     struct mystruct { ... };
After I saw the user, it became obvious. I compiled it with visual
studio and it did not complain. (The documentation says it is the
correct way too.)



More information about the dev mailing list