What validation suites can't do (was Re: __STDC__ and non-strictly conforming ANSI C compilers)

Barry Margolin barmar at think.COM
Sat Dec 17 06:36:02 AEST 1988


In article <5202 at bsu-cs.UUCP> dhesi at bsu-cs.UUCP (Rahul Dhesi) writes:
>Perhaps a solution would be for somebody to come up with a C compiler
>validation suite, and also a trade-marked term such as "__VALIDC__".

Unfortunately, a validation suite would have a hard time failing an
implementation that has extensions that define new reserved words.  It
would only fail if it happened to use one of the new reserved words as
an ordinary identifier.  You can try to catch some of the more common
extensions by trying to use "near", "far", and "asm" as identifiers,
but how are you going to guess that my implementation reserves the
word "frobnicate"?

Similarly, suppose an implementation defines a new operator, using a
syntax that is undefined by the standard (e.g. the much-discussed "^^"
short-circuit XOR :-).  How would a validation suit discover this
invalidity?

The latter case isn't as much of a problem as the former, because it
only causes non-conforming programs to work.  Defining new reserved
words in the user namespace can cause strictly-conforming programs to
fail.

Barry Margolin
Thinking Machines Corp.

barmar at think.com
{uunet,harvard}!think!barmar



More information about the Comp.std.c mailing list