prev up next   top/contents search

comp.lang.c FAQ list · Question 19.42

Q: Why isn't any of this standardized in C? Any real program has to do some of these things.


A: Actually, some standardization has occurred along the way. In the beginning, C did not have a standard library at all; programmers always had to ``roll their own'' utility routines. After several abortive attempts, a certain set of library routines (including the str* and stdio families of routines) became a de facto standard, at least on Unix systems, but the library was not yet a formal part of the language. Vendors could (and occasionally did) provide completely different routines along with their compilers.

In ANSI/ISO Standard C, a library definition (based on the 1984 /usr/group standard, and largely compatible with the traditional Unix library) was adopted with as much standing as the language itself. The Standard C library's treatment of file and device I/O is, however, rather minimal. It states how streams of characters are written to and read from files, and it provides a few suggestions about the display behavior of control characters like \b, \r, and \t, but beyond that it is silent. (Many of these issues are, however, addressed and standardized in Posix.)

If the Standard were to attempt to define standard mechanisms for accessing things like keyboards and displays, it might seem to be a big convenience for programmers. But it would be a monumental task: there is already a huge variety of display devices, and huge variation among the operating systems through which they are usually accessed. We cannot assume that the years to come will offer any less variety.

At one time the common output device for C programs was a Teletype; later it was a ``dumb'' terminal, after that it was a ``smart'' VT100 or other ANSI X3.64-compatible terminal which today might be called ``dumb.'' Today it's likely to be a bitmapped color display screen. What will it be in five years? How will the operating systems of that time deal with its capabilities?

See also question 11.34.

References: Rationale Sec. 2.2.2, Sec. 4.9, Sec. 4.9.2


prev up next   contents search
about this FAQ list   about eskimo   search   feedback   copyright

Hosted by Eskimo North