[ovs-dev] [PATCH 3/3] Avoid uninitialized variable warnings with OBJECT_OFFSETOF() in MSVC.

Eitan Eliahu eliahue at vmware.com
Fri Sep 12 16:54:52 UTC 2014


Yes, it is C++ type specifier ( part "C++11" extensions) but we could compile our C code to use it.
I came across  a custom implementation of "typeof" (but C++ too):
http://www.boost.org/doc/libs/1_55_0/boost/typeof/msvc/typeof_impl.hpp

-----Original Message-----
From: Ben Pfaff [mailto:blp at nicira.com] 
Sent: Friday, September 12, 2014 8:12 AM
To: Eitan Eliahu
Cc: Gurucharan Shetty; dev at openvswitch.org; Gurucharan Shetty
Subject: Re: [ovs-dev] [PATCH 3/3] Avoid uninitialized variable warnings with OBJECT_OFFSETOF() in MSVC.

On Fri, Sep 12, 2014 at 02:11:00PM +0000, Eitan Eliahu wrote:
> [2] The usage of the decltype  does work with of a built in VS project I created:
> #define OBJECT_OFFSETOF(OBJECT, MEMBER) \
>       ((LONG)(LONG_PTR)&((decltype(OBJECT))0)->MEMBER)
> I think it is the right way to implement it. But, this keyword "decltype" is ignored by the compiler when above  macro is used in the OVS source base. I don't know the reason for it but it might be related to custom compilation options we use (or others we don't use).

decltype is a C++ keyword I believe.



More information about the dev mailing list