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: Request support for C11 static assertions

Expert 1226 points


Tool/software: TI C/C++ Compiler

C11 adds support for static assertions, tests we can put into our C code that will prevent compilation and linking if they fail.

This feature is significantly more powerful than pre-processor #if / #error checks.

This would be of great help for us in the development of safety-rated firmware in particular, but also for general-purpose development.


Can support for this C11 feature be added to TI's ARM Optimizing C/C++ Compiler?

--thx

  • The issue CODEGEN-1369 is already filed in the SDOWP system.  It requests several C11 features, including static assert.  You are welcome to follow it with the SDOWP link below in my signature.  I added this forum thread to the record.

    Thanks and regards,

    -George

  • I was not able to find CODEGEN-1369 in SDOWP.

    I did find SDSCM00045863, which I see has a link to this forum thread.

    Just to be clear, however, SDSCM00045863 specifically refers to "Implement selected C++11 features".  Presumably this refers to the ISO/IEC 14882:2011 C++ specification.

    C++ is a fine language, but I'm currently in a C shop.  My request is for the static assertion specified by the ISO/IEC 9899:2011 C specification, also described here:

    http://www.robertgamble.net/2012/01/c11-static-assertions.html

    https://www.ibm.com/support/knowledgecenter/SSLTBW_2.1.0/com.ibm.zos.v2r1.cbclx01/sadecc1x.htm

    My apologies for splitting hairs; I imagine that implementing C11 static assertions and C++11 static assertions will be almost exactly the same effort.

    However, there is no description of any relative priorities in SDSCM00045863.  C++11 has a lot of stuff in it.  C11 static assertions are head-and-shoulders more important to us than anything in C++11.  (For that matter, static assertions are more important to us than anything else in C11, although _Atomic would certainly be nice.)

    I would also hate for implementation of C11 static assertions to be delayed under the hypothetical-and-incorrect argument "it's a C++ feature, and only X percent of our customers use C++". 

    Er, incidentally, what _is_ the comparison between how many TI customers use C++ versus C?


    --thx

  • 1138 said:
    I was not able to find CODEGEN-1369 in SDOWP.

    Sorry about that. I don't know what is wrong. I have started asking from my end.

    1138 said:
    Just to be clear, however, SDSCM00045863 specifically refers to "Implement selected C++11 features".

    Yes, it does. I overlooked that detail.

    1138 said:
    My apologies for splitting hairs; I imagine that implementing C11 static assertions and C++11 static assertions will be almost exactly the same effort.

    It is. In fact, these features are linked in the implementation plan. They will be introduced in the same release. This is true for many of the C++11 and C11 features.

    1138 said:
    I would also hate for implementation of C11 static assertions to be delayed under the hypothetical-and-incorrect argument "it's a C++ feature, and only X percent of our customers use C++". 

    That is not the case.

    1138 said:
    Er, incidentally, what _is_ the comparison between how many TI customers use C++ versus C?

    We have not done any formal studies on this question. It is very clear there is enough of both to justify our long term support of both languages.

    Thanks and regards,

    -George