Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

183
Vistas
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?

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

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.

over 4 years ago · Santiago Trujillo Denunciar

0

The standard only very loosely defines what "semantics" actually mean. Most importantly, there is no definition of the term in section 3 Terms, definitions, and symbols of the standard.

What the standard does define in that section is the meaning of "constraint":

3.8

1 constraint

restriction, either syntactic or semantic, by which the exposition of language elements is to be interpreted

Added emphasis on "...or semantic".

The standard then goes on:

4. Conformance

1 In this document, "shall" is to be interpreted as a requirement on an implementation or on a program; conversely, "shall not" is to be interpreted as a prohibition.

2 If a "shall" or "shall not" requirement that appears outside of a constraint or runtime-constraint is violated, the behavior is undefined.

And then we come to:

5.1.1.3 Diagnostics

1 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.

Added emphasis on "...or constraint".

As per 3.8, being "only" a semantic restriction does not rule out something being a constraint.

As per 4. 1), a "shall" is a requirement, a "shall not" a prohibition.

I interpret both to indicate a constraint.

As per 5.1.1.3, not only violated syntax rules, but also violated constraints require a diagnostic, even if (as per 4. 2)) "[...] the behavior is also explicitly specified as undefined or implementation-defined."


Note, however, to avoid misunderstandings:

I am referring here to semantics specified with a "shall" / "shall not" in the standard, not any which semantics of any which program.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda