4.1. ChangesThe 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
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). Footnotes1. Stroustrup B. (1991). The C++ Programming Language 2nd edn. Reading, MA: Addison-Wesley |
The C BookThis 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. |
|
West Yorkshire Office
GBdirect Ltd
Training: 0800 651 0338 Please call between 0900 and 1700 (UK time) on Monday to Friday South East Regional Office
GBdirect Ltd
Training: 0800 651 0338 Please call between 0900 and 1700 (UK time) on Monday to Friday Please note: |