This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/MSP430G2755: _CPP_STYLE_HEADER.. Where is it defined and what qualifies as that style?

Part Number: MSP430G2755

Tool/software: TI C/C++ Compiler

I have noticed the usage of:

#if defined(__cplusplus) && !defined(_CPP_STYLE_HEADER)

and similar statements in the TI header files.

Are there any header files where _CPP_STYLE_HEADER is actually defined?

I assume it would be a header file that conformed to the expected style which leads me to my next question:

What is the requirement for a "cpp style header"?

Regards,

Jim

  • This macro is strictly an implementation detail. You should not set or test this macro. In some versions of the C++ standard header files distributed by TI which mimic the C standard functions (e.g. <cerrno>), this macro is used so that cerrno may include errno.h so that the implementation of both files could be contained in errno.h. You can see it in action in the file cerrno. It seems that more recent TI compiler releases have moved away from using this macro.
  • To repeat what Archaeologist said ... _CPP_STYLE_HEADER, and every other preprocessor symbol that starts with an underscore, is used to implement features in the RTS functions and header files.  Such symbols are subject to change or removal at any time, with no notice.

    Still, if you want to know the details, here is one way to see it.  Use compiler version 16.9.x.LTS.  (A version that is close should work as well, but 16.9.x.LTS is the only one I tried.)  Include <cstring> in a C++ (not C) source file.  Build it with the switch --gen_acp_raw.  This creates a raw listing file with the extension .rl.  Read about this option in the MSP430 compiler manual, especially the explanation of the contents of a raw listing file.  Search that .rl file for the symbol _CPP_STYLE_HEADER.  You will see where it gets defined, and how it is used.

    Thanks and regards,

    -George