[comp.lang.c] draft ANSI standard: a "conforming program" could be anything

gnu@hoptoad.uucp (John Gilmore) (12/02/86)

[This is posted to comp.lang.c because mod.std.c seems to be dead.  Love
those mod groups!]

I believe that the definition of a "conforming program" is too weak.
From section 1.6, Compliance:

> 	A _strictly conforming program_ shall use only those features of
> the language and library specified in this Standard.  It shall not
> produce output dependent on any unspecified or implementation-defined
> behavior (except for locale-specific characteristics), and shall not
> exceed any minimum implementation limit.
> 
> 	A _conforming hosted implementation_ shall accept any strictly
> conforming program.  ...  A conforming implementation may have
> extensions...provided they do not alter the behavior of a strictly
> conforming program.
> 
> 	A _conforming program_ is one that is acceptable to a conforming
> implementation.*
> --
> * Strictly conforming programs are intended to be maximally portable.
> Conforming programs may depend upon nonportable features of a conforming
> implementation.

It sounds to me like a conforming program is any program that compiles
under any C compiler.  I am wondering how this is a useful definition.
What bearing does this have on whether the program adheres to the
standard?  If I wrote a C compiler that switched to assembler language
when it saw a "$" character (a valid extension), and did:
	(echo '$'; cat foo.s) >foo.c
then foo.c would be a conforming program by this definition.

The Rationale says:

> 	A _strictly conforming program_ is another term for a maximally
> portable program.  The goal is to give the programmer a _fighting
> chance_ to make powerful C programs that are also highly portable,
> without demeaning perfectly good C programs that happen not to be
> portable.  Thus the adverb _strictly_.

I don't see how a program is "demeaned" by the assertion that while it
is "perfectly good" and useful, it is not in conformance with the
standard.  The purpose of the standard is portability, not making
programs feel good about themselves.  I don't get the bit about
fighting chances and powerful programs, either; it sounds like it was
written by the ANSI marketing department.

> 	_Conforming program_ is thus the most tolerant of all categories,
> since only one conforming implementation need accept a program to rule
> it conforming.  The primary limitation on this license is section
> 2.1.1.3.

Section 2.1.1.3 (Diagnostics) consists of:

>	A conforming implementation shall produce at least one
> diagnostic message for every source file that contains a violation of
> any syntax rule or constraint.  Unless otherwise specified, if a
> semantic requirement on a program is violated, the behavior is
> undefined.

I don't see how this has anything to do with what makes a program
conforming or non-conforming.

I think that the definition of "conforming program" should be deleted,
and that a "strictly conforming program" should be renamed a "conforming
program".
-- 
John Gilmore  {sun,ptsfa,lll-crg,ihnp4}!hoptoad!gnu   jgilmore@lll-crg.arpa
Call +1 800 854 7179 or +1 714 540 9870 and order X3.159-198x (ANSI C) for $65.
Then spend two weeks reading it and weeping.  THEN send in formal comments! 

gwyn@brl-smoke.ARPA (Doug Gwyn ) (12/02/86)

In article <1383@hoptoad.uucp> gnu@hoptoad.uucp (John Gilmore) writes:
>...  The purpose of the standard is portability, not making
>programs feel good about themselves.  I don't get the bit about
>fighting chances and powerful programs, either...

"The" purpose is putting it a bit strong.  One way to enhance
portability would be to emasculate the language.  Much of the
wording about conformance is intended to accommodate the idea
of implementation-specific extensions and/or coding practices,
in order to protect C's sometime r^ole as a systems language.
You may note in various places in the draft that "conforming
program" (the weaker term) is used to cover programs that are
not strictly portable, in order to guarantee constraints on an
ANSI-compliant compiler when compiling such code.  Such wording
probably deserves careful checking to make sure that the right
term is used, and the definitions or the rationale perhaps need
more work (they've been revised several times already; this
fine degree of legalism seems hard to get just right).