Expert C Programming

(Jeff_L) #1

unique in a programming language standard. Members of the standardization committee have
commented that it was meant to guide the choice of minimum acceptable sizes.


Every ANSI C compiler is required to support at least:



  • 31 parameters in a function definition

  • 31 arguments in a function call

  • 509 characters in a source line

  • 32 levels of nested parentheses in an expression

  • The maximum value of long int can't be any less than 2,147,483,647, (i.e., long integers
    are at least 32 bits).


and so on. Furthermore, a conforming compiler must compile and execute a program in which all of
the limits are tested at once. A surprising thing is that these "required" limits are not actually
constraints—so a compiler can choke on them without issuing an error message.


Compiler limits are usually a "quality of implementation" issue; their inclusion in ANSI C is an
implicit acknowledgment that it will be easier to port code if definite expectations for some capacities
are set for all implementations. Of course, a really good implementation won't have any preset limits,
just those imposed by external factors like available memory or disk. This can be done by using linked
lists, or dynamically expanding the size of tables when necessary (a technique explained in Chapter
10 ).


The Structure of the ANSI C Standard


It's instructive to make a quick diversion into the provenance and content of the ANSI C standard. The
ANSI C standard has four main sections:


Section 4: An introduction and definition of terminology (5 pages).


Section 5: Environment (13 pages). This covers the system that surrounds and supports C, including
what happens on program start-up, on termination, and with signals and floating-point operations.
Translator lower limits and character set information are also given.


Section 6: The C language (78 pages) This part of the standard is based on Dennis Ritchie's classic
"The C Reference Manual" which appeared in several publications, including Appendix A of The C
Programming Language. If you compare the Standard and the Appendix, you can see most headings
are the same, and in the same order. The topics in the standard have a more rigid format, however, that
looks like Figure 1-4 (empty subparagraphs are simply omitted).


Figure 1-4. How a Paragraph in the ANSI C Standard Looks
Free download pdf