[C++] extern "C" and namespaces

From: the Bare (grrr_at_wild.net)
Date: 10/27/03


Date: Mon, 27 Oct 2003 22:52:26 GMT

Hi:

Is the following legal? It compiles, but is this guaranteed according
to the standard?

// In a header file
namespace opt
{
extern "C"
{

inline int func( int i, double d )
{
   extern int efunc( int, double );
   efunc( i, d );
}

} // extern "C"
} // namespace opt

I'm doing this because I'm trying to avoid polluting the global
namespace, which the following would do:

// In a header file
extern "C"
{
extern int efunc( int i, double d );
}

Thanks,
Cameron



Relevant Pages