Post by Bill Cunningham
I read the standard and if I'm reading it right to be a constraint
violation there must be undefined behavior. What exactly is a constraint
violation? Specifically concerning strtol for example?
I think you have the cause and effect reversed.
If a C program violates either a syntax rule or a constraint, a
conforming compiler must issue a diagnostic. This can be either
a fatal error message (causing the compilation to fail) or a
non-fatal warning (possibly permitting the compilation to succeed).
See N1570 18.104.22.168.
(The only cases where a compiler *must* fail is when there's a #error
directive that's not removed by #if, #ifdef, et al.) See N1570 4p4.
Once a compiler detects a constraint violation and issues a
diagnostic, it's done its job as far as the standard is concerned.
*If* it goes on to generate an executable program, that program's
behavior is undefined. (This might be a slight oversimplification,
but not in any way worth worrying about.) Extensions can be
implemented this way.
All constraints are explicitly defined in the standard, in paragraphs
clearly marked "Constraints".
I'm ignoring your reference to strtol because it has no relevance
to the rest of your question.
Keith Thompson (The_Other_Keith) email@example.com <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"