On Tue, Jun 24, 2008 at 08:27:59PM -0400, David Chin wrote:
> The __cplusplus macro is part of the ISO C++ standard, defined
> precisely because the standards committee knew (presumably) that there
> would be people who would want to use their old plain C stuff.
>
> Similarly, ISO C has the macro __STDC__ defined.
Both true, but irrelevant. The C++ coders have extern "C" so
that they can use their old C stuff. The __cplusplus define
is so that you can *pretend* that C code is C++ code.
> See here:
http://docs.sun.com/app/docs/doc/819-5267/bkaep?a=view>
> So, it is more than just idiom. It's required of a standards-compliant compiler.
No, it's just idiom, because these are C headers that we're
talking about.
Done properly, the C++ code would have:
extern "C" {
#include <atlas.h>
}
and then everyone would be happy, and there would be no need for
spurious #ifdef bracketing in the C header.
The problem is the whole notion that a header file can
meaningfully be both a C header file and a C++ header file. If
you replace C++ by, say, Eiffel in that sentence, the statement
gets a bit more obvious.
> Cheers,
> Dave
>
> On Tue, Jun 24, 2008 at 7:13 PM, Andrew Reilly
> <
andrew-atlas@...> wrote:
> > 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.
C compilers mightn't see it, but C coders will, and they'll
cringe every time. I know that I do.
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