Re: including sparse headers in C++ code

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

 



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@xxxxxxxxxxxxxxxxxxx
                     LUGA : http://www.luga.at

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux