3 ms·
How else would you define the legality of a C program? The language specification comes with constraints, and code which violates those will probably fail to co
by cygx 14y ago
How else would you define the legality of a C program? The language specification comes with constraints, and code which violates those will probably fail to compile (eg syntax errors); any other semantic violation (ie when you see 'shall' or 'shall not' outside of a constraint clause) only results in undefined behavior.
See also the C99 rationale:
"Undefined behavior gives the implementor license not to catch certain program errors that are difficult to diagnose. It also identifies areas of possible conforming language extension: the implementor may augment the language by providing a definition of the officially undefined behavior."
Undefined behavior only occurs in case of program errors or language extensions, in which case you're not dealing with standard C, but C-with-extensions.