4.1. Changes
The single worst feature of Old C was that there was no way to declare
the number and types of a function's arguments and to have the compiler
check that the use of the function was consistent with its declaration.
Although it didn't do a lot of damage to the success of C, it did result
in portability and maintainability problems that we all could have done
without.
The Standard has changed that state of affairs. You can now declare
functions in a way that allows their use to be checked, and which is also
largely compatible with the old style (so old programs still work,
provided they had no errors before). Another useful feature is a portable
way of using functions with a variable number of arguments, like
printf , which used to be non-portable; the only way to
implement it relied upon intimate knowledge of the hardware involved.
The Standard's way of fixing this problem was in large measure to
plagiarize from C++, which had already tried out the new ideas in
practice. This model has been so successful that lots of ‘Old’ C
compilers adopted it on their way to conforming to the Standard.
The Standard still retains compatibility with Old C function
declarations, but that is purely for the benefit of existing programs.
Any new programs should make full use of the much tighter checking that
the Standard permits and strenuously avoid the old syntax (which may
disappear one day).
Footnotes
|
Printer-friendly version
The C Book
This book is published as a matter of historical interest.
Please read the
copyright and disclaimer information.
GBdirect Ltd provides up-to-date training and consultancy in
C,
Embedded C,
C++
and a wide range of
other subjects based on
open standards if you happen to be interested.
|