Why gripes about C enums should be taken in context

utzoo!decvax!harpo!npoiv!npois!cbosgd!mark utzoo!decvax!harpo!npoiv!npois!cbosgd!mark
Wed Nov 10 14:58:53 AEST 1982


Alan forgot to mention the single most important addition to C
since V6: #include with <> brackets!

In V6, there was no /usr/include, and of course, no /usr/include/sys.
All system calls which dealt with structures contained the text of
the structure in the manual page, and programs were expected to copy
the structure declation into their program.  Thus, all hope of being
portable to any machine except a PDP-11 was gone.  Only when the
#include <xx.h> convention started to take hold did UNIX begin to
become portable.  (I suppose rewriting it in C was another major
step in that direction, too.)

This, of course, implies that there was no standard I/O.  With no
<stdio.h>, all I/O was done with putchar and printf (which always
went to stdout) and getchar, which always read from stdin.  (There
was a way to divert this to another file descriptor, which even
the programmers manual called a "kludge".)  There was a putc/getc
package that required you to declare a 518 byte buffer (not a structure
with a 512 byte char array, two pointers, and an integer, mind you,
but a 518 byte buffer!) and implemented essentially fopen, putc,
getc, and fclose (but this could not be used with printf, and there
was no scanf.)  There was something called the "portable C library"
which implemented printf, fprintf, and sprintf with one routine
called printf, like this:
	printf("format", args);		/* printf */
	printf(fd, "format", args);	/* fprintf */
	printf(-1, buf, "format", args);/* sprintf */
The portable C library didn't get used much - it was inefficient,
and not especially robust.

We've really come a long way!  Of course, it's been six years since
V6 was released, and no doubt longer since it was packaged.  six
years is half the lifetime of UNIX and 1/5th the lifetime of the
entire Computer Science field.



More information about the Comp.lang.c mailing list