[comp.lang.c] Undefined behaviour in standards

kurtl@fai.UUCP (Kurt Luoto) (10/17/89)

In article <14089@lanl.gov> jlg@lanl.gov (Jim Giles) writes:
>From article <11312@smoke.BRL.MIL>, by gwyn@smoke.BRL.MIL (Doug Gwyn):
>> In article <20974@gryphon.COM> bagpiper@pnet02.gryphon.com (Michael Hunter) writes:
>>>In the following code fragment is line 3 ambiguous from an X3J11 standpoint
>>>or from a historical standpoint.

[ stuff deleted ... ]

>The order of evaluation of function arguments is _Unspecified_ not
>_Implementation_defined_.  This means that the evaluation order is
>allowed to vary EVEN WITHIN AN IMPLEMENTATION!  This is supposedly
>to allow optimization.
>
>It is my opinion that _Unspecified_ and _Undefined_ have no place in
>a language definition.  _Implementation_defined_ should be used as little
>as possible.  Apparently, X3J11 thought otherwise (this makes C the only
>ANSI language with deliberately undefined, as opposed to implementation
>defined, behaviour).

IMHO _Unspecified_ and _Undefined_ are quite important in language definitions.
That which is left out of a language specification (or any product specification
for that matter) is almost as important as what is included.  If you want to
design a language for a very broad range of uses, platforms, and
implementations, there will most likely be certain areas of the language
where you want to leave the implementor a certain degree of freedom.
Of course, you don't have to follow this philosophy the next time YOU design
a language, but most "successful" languages that I have seen (i.e. a large
following, many users) have at least some of these areas.

I regard it as good foresight when a standard identifies these areas explicitly.
The alternative is to leave them undefined implicitly by not mentioning them.
This sometimes leads to flame wars (which may be fun but not productive),
or to "de facto" standards (sometimes several competing ones) which is in part
what a standard is trying to resolve or avoid.

I am not familiar with all the ANSI standard languages, but I would be
surprised if there were not a few of them other than C which also have
(perhaps implicitly) undefined areas.

-------
Kurt W. Luoto		kurtl@fai.fai.com  or  ...!sun!fai!kurtl