C with Classes(ID:886/cwi002)
OO Extensions to C
Short-lived predecessor to C++.
The aim of the class design was to provide the C programmer with a set of tools allowing the structure of a "medium sized C program*" to be expressed more clearly and directly than had been possible before. The practical integration of the class concept with the facilities of the C programming environment was considered far more important than any abstract notion of programming language perfection.
The programmer is not asked to sacrifice "efficiency" to an abstract notion of beauty enforced through restrictions on the use of the language or through the provision of facilities which imply significant compile time or run time overheads. The aim has been to enhance C as a practical systems programming language, not to provide a new programming environment with a higher level of semantics. With the exception of the introduction of the new keywords class, public, etc. all older C programs preserve their meaning.
The permissive nature of C has been preserved. For example, it is possible to have public data members of a class and to use casts on class pointers, thus ignoring the ideal that all operations on an object of an abstract data type ought to be restricted to a few well defined operations. This ideal is, however, not shared by everybody, and therefore not enforced through the language design. If it is yours you can adhere to it, and because the class pre-processor records dependencies between classes you can easily verify if a program passes this criterion of cleanliness. A version of the class pre-processor, called class, will write out the recorded dependencies. Because a more general set of dependencies is recorded the output of class can be used for a variety of purposes. Another use would be to determine whether any function of a given class accessed global data, or whether any function of a class took advantage of the ability to access not only the object for which it was called, but also other objects of the same class.
It is common practice to provide non-trivial data structures with a set of access functions. This practice helps preserve the consistency of the data and also aids programmers in the task of writing and modifying programs. Classes have been added to the C language to allow functions to be explicitly associated with data, and to protect the data against "irregular" access from other functions.
in SIGPLAN Notices 17(01) January 1982 view details