On Sep 29, 2004, at 12:41, Daniel Walker wrote:
Unfortunately I can't really accept that solution as the
necessity for it is the exact problem I wished to address.
Furthermore, you may notice that
#ifndef LUA_API
#ifdef __cplusplus
#define LUA_API extern "C"
#else
#define LUA_API extern
#endif
#endif
is perfectly valid C code, which completely eliminates the
need for any C++ specifics, and would keep the issue in
question from ever arising again. There really isn't any
benefit in not writing a header like this, so why not?
That code is conforming C code, but not strictly conforming C code.
Since it uses a pre-processor token ("__cplusplus") that is in the
namespace reserved for the implementation, then any given C
implementation is allowed to assigned whatever meaning it likes to
that
code. Only the language C++ assigns a meaning to __cplusplus, the
language C makes no guarantees. It is only when you use a cooperating
C implementation that __cplusplus will have the meaning you like. In
other words a C implementation is at perfect liberty to define the
token __cplusplus for its own purposes.