From: Bernd Petrovitsch <bernd@petrovitsch.priv.at>
To: Christopher Li <sparse@chrisli.org>
Cc: Tomas Klacko <tomas.klacko@gmail.com>,
Al Viro <viro@zeniv.linux.org.uk>,
Josh Triplett <josh@joshtriplett.org>,
linux-sparse@vger.kernel.org
Subject: Re: including sparse headers in C++ code
Date: Wed, 13 Oct 2010 13:39:53 +0200 [thread overview]
Message-ID: <1286969993.14103.38.camel@thorin> (raw)
In-Reply-To: <AANLkTimhh3zj8kgvaSQq9_CS711mLw8skrWL4yUgvJzT@mail.gmail.com>
On Die, 2010-10-12 at 17:37 -0700, Christopher Li wrote:
[...]
> > However, I can probably try doing:
> > struct symbol
> > {
> > ...
> > #ifndef __cplusplus
> > enum namespace namespace;
> > #else
> > enum name_space ns;
> > #endif
>
> Even worse.
FullACK. That's IMHO the worst solution - sprinkling "#ifndef
__cplusplus" all over the place.
> I don't like the #ifndef __cplusplus at all. Try to keep it minimal.
> Just make it "enum name_space ns;" is clear better than maintain two
> different names.
*eg*
---- snip ----
#ifdef __cplusplus
#define namespace ns
#endif
---- snip ----
at the top would be simpler and keep the source readable. Nevertheless I
wouldn't do it either.
[...]
> > +#ifdef __cplusplus
> > +extern "C" {
> > +#endif
>
> Can you move this into your C++ code before including the sparse headers?
> I don't want it in the sparse headers. Sparse is compiled in C,
> shouldn't need to know
> C++ at all.
That is something common in .h files if they are intended for "mixed
use" and C libs use in C++ applications.
[...]
> > +#ifdef __cplusplus
> > +}
> > +#endif
> > +
[...]
Bernd
--
Bernd Petrovitsch Email : bernd@petrovitsch.priv.at
LUGA : http://www.luga.at
next prev parent reply other threads:[~2010-10-13 11:40 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-09 16:40 including sparse headers in C++ code Tomas Klacko
2010-10-09 20:59 ` Josh Triplett
2010-10-09 21:46 ` Christopher Li
2010-10-10 11:41 ` Bernd Petrovitsch
2010-10-10 11:52 ` Kamil Dudka
2010-10-11 9:44 ` Bernd Petrovitsch
2010-10-11 16:04 ` Christopher Li
2010-10-11 19:12 ` Josh Triplett
2010-10-13 14:45 ` Bernd Petrovitsch
2010-10-18 18:43 ` Christopher Li
2010-10-20 7:29 ` Al Viro
2010-10-20 9:39 ` Bernd Petrovitsch
2010-10-20 15:34 ` Christopher Li
2010-10-29 13:22 ` Bernd Petrovitsch
2010-11-05 0:57 ` Christopher Li
2010-11-09 13:28 ` Bernd Petrovitsch
2010-11-09 22:52 ` Christopher Li
2010-11-10 10:52 ` Bernd Petrovitsch
2010-10-11 22:33 ` Tomas Klacko
2010-10-11 22:46 ` Al Viro
2010-10-11 23:01 ` Christopher Li
2010-10-12 22:45 ` Tomas Klacko
2010-10-13 0:37 ` Christopher Li
2010-10-13 11:39 ` Bernd Petrovitsch [this message]
2010-10-16 16:03 ` Tomas Klacko
2010-10-16 19:11 ` Josh Triplett
2010-10-17 10:31 ` Tomas Klacko
2010-10-18 4:13 ` Christopher Li
2010-10-18 5:39 ` Josh Triplett
2010-10-18 18:37 ` Christopher Li
2010-10-19 20:03 ` Tomas Klacko
2010-10-19 21:31 ` Al Viro
2010-10-19 21:46 ` David Malcolm
2010-10-19 22:12 ` Al Viro
2010-10-19 22:49 ` Tomas Klacko
2010-10-20 10:19 ` Bernd Petrovitsch
2010-10-19 23:07 ` Christopher Li
2010-10-20 7:40 ` Al Viro
2010-10-18 3:16 ` Christopher Li
2010-10-11 23:37 ` Josh Triplett
2010-10-12 10:42 ` Bernd Petrovitsch
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=1286969993.14103.38.camel@thorin \
--to=bernd@petrovitsch.priv.at \
--cc=josh@joshtriplett.org \
--cc=linux-sparse@vger.kernel.org \
--cc=sparse@chrisli.org \
--cc=tomas.klacko@gmail.com \
--cc=viro@zeniv.linux.org.uk \
/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.