All of lore.kernel.org
 help / color / mirror / Atom feed
From: Razvan Cojocaru <rzvncj@gmail.com>
To: Tim Deegan <tim@xen.org>
Cc: xen-devel@lists.xensource.com
Subject: Re: [PATCH] libxc, libxenstore: make the headers C++-friendly
Date: Tue, 22 Jan 2013 19:12:15 +0200	[thread overview]
Message-ID: <50FEC86F.4020308@gmail.com> (raw)
In-Reply-To: <20130122165724.GD87324@ocelot.phlegethon.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 <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

  reply	other threads:[~2013-01-22 17:12 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-22 16:44 [PATCH] libxc, libxenstore: make the headers C++-friendly Razvan Cojocaru
2013-01-22 16:53 ` Jan Beulich
2013-01-22 17:02   ` Ian Campbell
2013-01-22 17:18     ` Razvan Cojocaru
2013-01-22 17:19     ` Jan Beulich
2013-01-22 17:07   ` Razvan Cojocaru
2013-01-22 17:12     ` Jan Beulich
2013-01-22 17:21       ` Razvan Cojocaru
2013-01-22 17:24         ` Ian Campbell
2013-01-22 17:29           ` Razvan Cojocaru
2013-01-22 17:30             ` Andrew Cooper
2013-01-22 17:26         ` Jan Beulich
2013-01-22 17:26       ` Razvan Cojocaru
2013-01-22 17:31         ` Tim Deegan
2013-01-22 17:44           ` Razvan Cojocaru
2013-01-23  8:25         ` Jan Beulich
2013-01-22 16:57 ` Tim Deegan
2013-01-22 17:12   ` Razvan Cojocaru [this message]
2013-01-22 17:28     ` Tim Deegan
2013-01-22 17:34       ` Razvan Cojocaru

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50FEC86F.4020308@gmail.com \
    --to=rzvncj@gmail.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.