[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] libxc, libxenstore: make the headers C++-friendly



+#ifdef __cplusplus
+extern "C" {
+#endif
+

The Xen public headers are in C, not C++. Doesn't this kind of
boilerplace belong in the C++ file that's trying to include a C header?

That's the whole point, if they were in C++ there would have been no need for the extern "C". It is, of course, possible to to this from your C++ code:

extern "C" {
#include <C_header.h>
}

However, most well-behaved C libraries do that for all their headers.
A few random examples on my Arch Linux system:

$ grep __cplusplus zlib.h
#ifdef __cplusplus
#ifdef __cplusplus

$ grep __cplusplus xvid.h
#ifdef __cplusplus
#ifdef __cplusplus

$ grep __cplusplus lzx.h
#ifdef __cplusplus
#ifdef __cplusplus

$ grep __cplusplus curses.h
#if defined(__cplusplus)        /* __cplusplus, etc. */
#endif /* !__cplusplus, etc. */
#ifdef __cplusplus
#ifdef __cplusplus

Pretty much all of them.

Cheers,
Razvan Cojocaru

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.