Re: #ifdef __cplusplus
Richard wrote:
It's up to the OP. __cplusplus doesn't have much meaning in C, and
extern "C" even less, so if you want to be sure of your answers, you're
better asking a C++ expert.
Phil
Richard wrote:
Philip Potter <pgp@doc.ic.ac. ukwrites:
>
>
The answer has been given exactly as is more than once. Traipsing over
there is slightly overkill IMO.
>
>mattia wrote:
>Others have stated what it means; I'd just add that I've usually seen
>this idiom used in system header files (such as stdio.h) so that the
>same header can be used for both C and C++ compilers. C compilers (DS9K
>excluded) don't define __cplusplus and don't see the extern "C" bit,
>while C++ compilers do define it and so know that all the stdio.h
>functions declared are C-style functions and linked in a C-style way.
>>
>I wouldn't recommend this practice in your own code.
>>
>extern "C" has no defined meaning in C. You'd probably get better
>answers in comp.lang.c++.
>>
>Philip
>>I've see in some code:
>>>
>>#ifdef __cplusplus
>> extern "C"
>> {
>>#endif
>>>
>>what does it mean?
>>>
>>Thanks
>>>
>>#ifdef __cplusplus
>> extern "C"
>> {
>>#endif
>>>
>>what does it mean?
>>>
>>Thanks
>this idiom used in system header files (such as stdio.h) so that the
>same header can be used for both C and C++ compilers. C compilers (DS9K
>excluded) don't define __cplusplus and don't see the extern "C" bit,
>while C++ compilers do define it and so know that all the stdio.h
>functions declared are C-style functions and linked in a C-style way.
>>
>I wouldn't recommend this practice in your own code.
>>
>extern "C" has no defined meaning in C. You'd probably get better
>answers in comp.lang.c++.
>>
>Philip
The answer has been given exactly as is more than once. Traipsing over
there is slightly overkill IMO.
extern "C" even less, so if you want to be sure of your answers, you're
better asking a C++ expert.
Phil
Comment