Topic: Undefined behavior [was: Virtual functions and destructors]
Author: clamage@Eng.Sun.COM (Steve Clamage)
Date: 1995/11/13 Raw View
In article HF8@falcon.daytonoh.attgis.com, Dick Menninger <Dick.Menninger@daytonoh.attgis.com> writes:
>
>Actually, "undefined behavior" is a precisely
>defined term in the WP, and not just a vague
>common term.
Well, yes, sort of.
> The meanings are constrained (1.3)
>by text that starts "Permissible undefined behavior
>ranges from" and then give three categories
>of behavior that are permissible. ...
Not quite. The definition of undefined behavior is given as "Behavior ...
for which the standard imposes no requirements." (1.3 Definitions).
The paragraph goes on to give examples of possible responses, but does
limit reponses to those examples.
In addition, section 1.7 "Processor compliance" pp 2 says:
"If an ill-formed program contains no diagnosable errors, this
International Standard places no requirements on implementations with
respect to that program."
I don't see how the standard could be more explicit than that: "undefined
behavior" means undefined behavior. The standard imposes NO requirements.
Finally, the C++ draft standard is different from the C standard in an
important way regarding undefined behavior. In the C standard, violation
of a "shall" clause outside a "constraint" section results in undefined
behavior. The C++ draft standard has no "constraint" sections. Instead,
violation of a "shall" clause requires a diagnostic message unless the
clause is marked otherwise.
---
Steve Clamage, stephen.clamage@eng.sun.com
---
[ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
Contact address: std-c++-request@ncar.ucar.edu. The moderation policy
is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]