Is support of Annex K in C11 required for a conforming implementation?

后端 未结 2 604
攒了一身酷
攒了一身酷 2020-12-10 16:38

While answering a question that made use of some functions (sscanf_s and sprintf_s) that I thought were not standard C, Daniel Fischer brought to m

相关标签:
2条回答
  • 2020-12-10 17:05

    It's "normative" in the sense that an implementation claiming to support Annex K must meet the requirements therein. It's not mandatory.

    0 讨论(0)
  • 2020-12-10 17:17

    Annex K is optional; it says so itself.

    See K.2 paragraph 2:

    An implementation that defines __STDC_LIB_EXT1__ shall conform to the specifications in this annex.

    with a footnote:

    Implementations that do not define __STDC_LIB_EXT1__ are not required to conform to these specifications.

    And paragraph 3 says:

    Subclause K.3 should be read as if it were merged into the parallel structure of named subclauses of clause 7.

    which is why it's not necessary to mention it in the library section, clause 7 (or at least the authors of the standard didn't feel it was necessary).

    An implementation that defines __STDC_LIB_EXT1__ must define it as 201112L; both N1570 and the released C11 standard got this wrong, but it was fixed in a Technical Corrigendum.

    0 讨论(0)
提交回复
热议问题