weeding out c++ keywords from sys/sys

Andrew Reilly andrew-freebsd at areilly.bpc-users.org
Sun Feb 15 22:07:58 PST 2009


On Sun, Feb 15, 2009 at 07:11:58PM +0100, Christoph Mallon wrote:
> Michael Butler schrieb:
> > .. stops C++ from mangling the prototyped functions so they'll link
> >correctly but does it temporarily disable the "reserved word" tests?
> >Should it? ;-)
> 
> No, it doesn't. extern $STRING (the standard only requires "C" and 
> "C++", but there can be more) just changes the linkage of declarations 
> (name mangling, calling convention).

I've always wondered: why does the extern "C" {} cruft have to
be pushed into all C headers, rather than being wrapped around
the #include <> lines in the C++ source that includes them?
Then you wouldn't need the #ifdef __cplusplus conditional,
because you already know that it's C++ code.  Common usage seems
to have it backwards, but I assume that there must be a reason.

Cheers,

Andrew


More information about the freebsd-current mailing list