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: __cplusplus defined to 201103L although C++11 is not supported

Tool/software: TI C/C++ Compiler

Hi everyone,

according to my knowledge and to the wiki, the TI compiler does not support the C++11 (and later) standards. I am currently detecting the currently supported standard via the __cplusplus macro as recommended by Stroustrup himself (http://www.stroustrup.com/C++11FAQ.html#11). However this does not work with the TI compiler version 15.12.4 LTS which is bundled with Code Composer Studio 6.2., as it defines __cpluplus to 201103L although the C++11 standard is not supported.

Is this intended behavior or a bug?

Thanks in advance,

Dan

  • Dan Cermak said:
    However this does not work with the TI compiler version 15.12.4 LTS which is bundled with Code Composer Studio 6.2., as it defines __cpluplus to 201103L

    I cannot reproduce this result.  When I try, it defines __cplusplus to be 1.

    That said, I think this is a violation of the standard.  I'm checking on that detail.

    Thanks and regards,

    -George

  • George Mock said:
    I think this is a violation of the standard.

    It is a violation.  Thank you for notifying us about this problem.  I filed CODEGEN-1976 in the SDOWP system to have this addressed.  You are welcome to follow it with the SDOWP link below in my signature.

    Thanks and regards,

    -George

  • While it is a violation of the standard, it is in line with the behavior or g++ 4.3, which our relaxed ANSI mode emulates.

    A valid workaround, assuming you have a strictly conforming C++ program, would be to send the -ps or --strict_ansi option to the compiler.

    However, we do agree that this emulation of earlier versions of g++ in this case is undesirable, and will still track and resolve the issue.

  • Thanks for doing that.
    I would like to add, that gcc 4.3 got released in 2008, way before C++11 was released, so probably no one really needed __cplusplus to have an actual value (other than being defined), since the only present standards were C++03 & C++98 (which are basically equal). In my case I am using the __cplusplus macro to backport some C++11 features, but I have replaced that temporarily with a check which compiler is used (GCC vs TI ARM).