From mboxrd@z Thu Jan 1 00:00:00 1970 From: Razvan Cojocaru Subject: Re: [PATCH] libxc, libxenstore: make the headers C++-friendly Date: Tue, 22 Jan 2013 19:12:15 +0200 Message-ID: <50FEC86F.4020308@gmail.com> References: <93e5f6cf98d2ae3539db.1358873051@rcojocaru.dsd.ro> <20130122165724.GD87324@ocelot.phlegethon.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20130122165724.GD87324@ocelot.phlegethon.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Tim Deegan Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org >> +#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 } 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