🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #39

Re: Curious about limits

#39
From: leichter
Date: Fri, 30 Oct 1992 14:03
50 lines
2946 bytes
In article <lf0nn6INNp2m@exodus.Eng.Sun.COM>, linden@positive.Eng.Sun.COM
(Peter van der Linden) writes:
| What was the reasoning behind the ANSI C standard specifying lower 
| limits on the sizes of programs that must successfully translate?
| 
| For example, a conforming compiler must allow at least 8 levels of nested
| #include files, or "at least 12 pointer, array, and function declarators
| (in any combination) modifying a ... type in a declaration."
| 
| Compiler limits are usually a "quality of implementation" issue; why
| write them into the standard?  I don't know any other language standard
| that specifies at this level.

Without some explicit minimum, it is impossible to write even very simple
strictly conforming programs.  Suppose there were no lower limit on
include file nesting.  Persumably, because the #include statement is
"required" in some sense, at least one "level of nesting" must be supported -
but no program in which a #include'd file had a #include in it would be
strictly conforming.

Or, suppose there were not lower limit on modifiers.  No program containing
an array of pointers would be strictly conforming.  (argv might be a special
case!)

Most standards do include some analogous lower limits.  For example, the
FORTRAN standard says you must support n-dimensional arrays for n up to
some limit (8?); you can go higher if you want.  This is directly analogous
to the C requirement on modifiers.

Every language standard I can think of has SOME lower limit on the number of
significant characters in a variable name.

Most languages use their analogues of #include files in a more restricted
fashion than typical C usage, and could probably get away with only one
level of inclusion.  What gets specified is what is found, by experience,
to be necessary to allow reasonable programs to be portable.

Agreed, you could always leave this to quality of implementation.  You
could to the same about ALL error messages, or ALL limits on variable
name lengths, or....  The line as to what to try to limit is ultimately
arbitrary, as are the particular limits chosen.  A hosted implementation
with the following implementation of malloc:

	void *malloc(size_t len)
	{	return (void *)0;	}

would be legal under the standard.  I'm sure that would break a hell of
a lot more code than changing the modifier limit to 11!

							-- Jerry
Technical Details
Message-ID: <1992Oct30.090310.1@zodiac.rutgers.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!dtix!darwin.sura.net!jvnc.net!yale.edu!qt.cs.utexas.edu!cs.utexas.edu!sun-barr!rutgers!igor.rutgers.edu!zodiac.rutgers.edu!leichter
References: <lf0nn6INNp2m@exodus.Eng.Sun.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!dtix!darwin.sura.net!jvnc.net!yale.edu!qt.cs.utexas.edu!cs.utexas.edu!sun-barr!rutgers!igor.rutgers.edu!zodiac.rutgers.edu!leichter
From: leichter@zodiac.rutgers.edu
Newsgroups: comp.std.c
Subject: Re: Curious about limits
Message-ID: <1992Oct30.090310.1@zodiac.rutgers.edu>
Date: 30 Oct 92 14:03:10 GMT
References: <lf0nn6INNp2m@exodus.Eng.Sun.COM>
Sender: news@igor.rutgers.edu
Organization: Rutgers University Department of Computer Science
Lines: 50
Nntp-Posting-Host: pisces.rutgers.edu