The C standard defines three streams with specific properties. These streams are stdin, stdout and stderr. Most programmers are already familiar with these, especially stdout in the context of the following program:
# include <stdio.h> /* This program is not part of the ISO standard, but it should be. */ main() { printf("Hello, world.\n"); }
It is not at all obvious what this program should do when run on a toaster, though, and no one really wants to add a serial port to a toaster just so the above program runs.
In fact, it does not make sense for toasters to support standard streams so standard streams are not required by the toaster program. The libstdio library deals with this case by declaring the standard stream pointers as external and letting the application supply the streams that make sense.
/* from stdio.h */ extern FILE*const stdin; extern FILE*const stdout; extern FILE*const stderr;
These are the declarations of the standard streams, but uCR provides no implementations of these variables and the linker will report an undefined symbol if a program tries to access them. The programmer that knows what to do about this implements code that initializes the appropriate streams and provides values for these pointers.
The toaster program that accidentally accesses these streams will fail to link until the problem is corrected. The VCR program may have an implementation of <tt/stdout/ that displays on an LCD, and the ``Hello, World'' program will link and execute just fine.