Search code examples
clanguage-lawyerc11standards-compliancec17

If "shall / shall not" requirement is violated, then does it matter in which section (e.g. Semantics, Constraints) such requirement is located?


If "shall / shall not" requirement is violated, then does it matter in which section (e.g. semantics, constraints) such requirement is located?

Reason of the question: this opinion:

This is in a Semantics section of the standard, not Constraints, so no diagnostic is required.

Is it true that violation of "shall / shall not" requirement located in the Semantics section does not require a diagnostics?


Solution

  • Semantic violations do not require a diagnostic message, while constraint violations do.

    Section 5.1.1.3p1 of the C11 standard regarding Diagnostics states the following:

    A conforming implementation shall produce at least one diagnostic message (identified in an implementation-defined manner) if a preprocessing translation unit or translation unit contains a violation of any syntax rule or constraint, even if the behavior is also explicitly specified as undefined or implementation-defined. Diagnostic messages need not be produced in other circumstances.