Max line length (was Re: programming challenge ...)

Doug Gwyn gwyn at smoke.BRL.MIL
Fri Mar 17 09:59:23 AEST 1989


In article <3072 at nunki.usc.edu> jeenglis at nunki.usc.edu (Joe English) writes:
->	   The implementation shall be able to translate and execute at
->	least one program that contains at least one instance of every
-        ^^^^^ ^^^ ^^^^^^^
->	one of the following limits:
-Huh?  Now I'm probably reading this wrong, but the way I
-parse this sentence it means:
- If (there exists a program P such that
-        (     (for all L in {following limits} P contains an instance of L)
-          and (the implementation can deal with P)
-        )
-    )
- then the implementation is in compliance with section 2.2.4.1.

Right.

-Shouldn't it say instead:
-  If (for all programs P such that 
-            (there exists an L in {following limits} such that P contains L)
-      the implementation can handle P
-     )
-  then the implementation is in compliance with section 2.2.4.1?

Nope.  If a program pushes all the limits simultaneously, an
implementation that dynamically allocates resources might be
unable to translate the program, yet still be perfectly usable
for the vast majority of programs.

-Put simply, if I write a compiler that will correctly
-translate and execute *one* program that contains a 509-character
-line, a 31-character identifier, and so on, but barfs
-on all other programs, does that pass 2.2.4.1?

Yes.

Here's the relevant text from the Rationale for Section 2.2.4.1:

	The Standard requires that an implementation be able to
	translate and compile some program that meets each of the
	stated limits.  This criterion was felt to give a useful
	latitude to the implementor in meeting these limits.
	While a deficient implementation could probably contrive
	a program that meets this requirement, yet still succeed
	in being useless, the Committee felt that such ingenuity
	would probably require more work than making something
	useful.  The sense of the Committee is that implementors
	should not construe the translation limits as the values
	of hard-wired parameters, but rather as a set of criteria
	by which an implementation will be judged.

	Some of the limits chosen represent interesting
	compromises.  The goal was to allow reasonably large
	portable programs to be written, without placing
	excessive burdens on reasonably small implementations.



More information about the Comp.lang.c mailing list