lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Wed Sep 29, 2004 at 14:40:02 +0100, David Jones wrote:
>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.

Incorrect. A C99 implementation is not allowed to define that macro.


The implementation shall not define the macro __cplusplus, nor shall it
define it in any standard header.

Benno (who doesn't know about C89)