On Thu, Nov 30, 2017 at 10:03 AM, Ben Pfaff <[email protected]> wrote:
> On Thu, Nov 30, 2017 at 02:47:34PM +0530, Shashank Ram wrote:
>> On Thu, Nov 30, 2017 at 11:45 AM, Ben Pfaff <[email protected]> wrote:
>> Sai and Shireesh, thanks for the patch. I share the same sentiments as Ben
>> regarding
>> the usage of the header files in lib/. Since OVS is written in C, and this
>> patch attempts
>> to allow some headers in lib/ to be compiled using MSVC++, it might set a
>> precedent
>> where other headers might require to be changed as well just to be able to
>> compile
>> it in C++.  This is not very intuitive to an OVS developer about the
>> consumption
>> of the header file by a C++ compiler.
>> I feel it would be better to add a public header file for some of the
>> common headers
>> being consumed outside of OVS, and maybe even a version of the header file
>> that compiles fine in C++.
>
> To add a few more details, OVS already has a policy that headers in
> include/openvswitch should compile as C++, and it even has checks that
> makes sure that they do.  So, if we decide to move some of the "lib"
> headers to "include/openvswitch", they would naturally work in C++, but
> on the other hand I'd like to have some idea of which headers are
> important for that purpose and ideally they would fall into some easily
> understood category or categories.
> _______________________________________________

Hi Ben and Shashank,

Thanks for bringing up this issue.  Given that the main consumers of
the "lib" headers are in C and it will take some efforts to make all
headers in "lib" to support various C++ compilers, I am thinking about
to make the C++ support in "lib" headers on demand.  That is when an
OVS developer is interested in using a header file in "lib" with C++,
the developer can work on that header file and add '#ifdef __cpluspuls
extern "C" {}...' to it indicating this header file has C++ support.
To avoid C++ support regression, we can utilize the same mechanism as
in https://mail.openvswitch.org/pipermail/ovs-dev/2017-July/336429.html
That is we can add another cxxtest.cc in "lib", and we manually add
C++ supported headers to /lib/cxxtest.cc for automatic C++ compilation
testing.  Definitely, if a header file is heavily use outside of OVS,
we shall consider move that into the public library
"include/openvswitch" to make sure the ABI compatibility.  However, it
is not clear to me that we move a header into the public library
because of C++ support.

Thanks,

-Yi-Hung
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to