« Return to Thread: C++ header files

Re: C++ header files

by Andrew Reilly-9 :: Rate this Message:

Reply to Author | View in Thread

On Tue, Jun 24, 2008 at 05:50:10PM -0500, skip@... wrote:
>     Clint> #ifdef __cplusplus
>     Clint> extern "C"
>     Clint> {
>     Clint> #endif
>     Clint> ....

> That is the standard idiom.  It will instruct the C++ compiler to not mangle
> the names between the braces (C linkage).  C compilers will not see it.

This is probably the wrong forum, but I've never understood why
that was considered to be the appropriate strategy.  Why should
C code have a bunch of spurious C++-related fluff added?  Surely
the correct approach is for C++ code to wrap C includes in
extern "C", as the syntax would seem to indicate?

Every other language that has some way of linking to C code (and
most do) has to do its own compatability shimming, with it's own
foreign-function interface.

My guess is that the process started when it was assumed that
C++ was the future of C, and eventually everything would just be
C++.  That is much less clearly the case, now, IMO.

Cheers,

--
Andrew

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Math-atlas-devel mailing list
Math-atlas-devel@...
https://lists.sourceforge.net/lists/listinfo/math-atlas-devel

 « Return to Thread: C++ header files