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.

Compile time initialization

HI All,

C++11 added the ‘constexpr’ moniker to guarantee compile-time initialization/construction of classes, but the current TI ARM compiler supports C++03 and not C++11.  What is the compiler’s behavior here if class constructors are declared throughout the code?  How does it decide whether it can or should initialize them at compile time vs runtime?

Thanks!

  • Sorry for the delay.

    As you note, constexpr is a C++11 feature, and the TI compiler does not support C++11.

    Initialization of C++ objects occurs at runtime.  There is another distinction to consider.  Simple assignments of constants to scalar members occurs during the ordinary creation of the C environment, and the constructor is not called.  More complicated initialization requires calling the constructor.

    Thanks and regards,

    -George