I just read the SO question , discussing scenarios in which part of the code is valid in both C and C ++, but will lead to different behavior in each language.
The question is: Could this be a problem when including C headers in C ++ code?
I know from this question that you should include C headers as follows:
extern "C" { #include <your_os_or_library_header_in_c.h> }
But all I have found so far is that extern "C" ensures that the name is turned off.
I could not find any information about whether it evaluates all statements as C, so, for example, sizeof('a') or 10 //* comment */ 2 (which you can find in the built-in function) are parsed as C, not C ++. (Note that relying on behaviors like someone who writes heading C is obviously a bad idea, but I ask for it from a purely academic point of view, βWhat if?β.)
Does the C ++ standard mean that the inclusion of a code block in extern "C" means that all its instructions must be parsed as C?
source share