Since the appearance of Smalltalk more than a decade ago, developers have looked for a way to combine the clear advantages of object-oriented programming — design clarity and code reusability — with the efficiency of optimized procedural-language compilers. The best-known attempt at an OOP-development environment for the Mac is Apple's own Object Pascal; combined with MacApp, Object Pascal constituted the earliest “easy” development environment for Mac applications. In the rest of the programming universe (mainly IBM PC and UNIX-based systems) the prime example is C++, an object-oriented version of C which is itself one of the most popular languages among professional programmers.
Now the Mac world has an object-oriented C from a major software house: Symantec’s Think C. (Think C is a subset of C++.) In itself, this would not be particularly newsworthy, but Symantec has done such a good job of Implementing this language that Think C is likely to become a standard. In the words of one developer, “Ifs as if you designed an ideal programming language in a dream and woke up to find out someone had mailed you a copy.” Let’s outline the reasons for this enthusiasm, and also determine whether one or two details might have been left out of this version of the dream.
Lots to C
First, Think C (formerly called Think’s Lightspeed C) has always been noted for its fast compiler, efficient linker, and well-designed project-management facility — these are widely considered to provide the snappiest C environment available on any computer. One programming manager for a large corporation that has recently switched to Think C from MPW remarked that having the link-compile cycle speeded up by 20 percent to 40 percent is the equivalent of getting an extra programming day per week. Second, the Think disk set contains all the tools (including a source-level debugger, inline assembler, and profiler) needed to make working applications, device drivers, resources, and desk accessories from traditional procedural-style C programs (see “Eating Bugs”). Third, as of version 3.0, the code produced by the Think C compiler now can match or beat the code-size and execution-speed benchmarks of other Mac C compilers, particularly for large projects. Although Think C is still not completely ANSI compliant, Symantec has changed Think C to enhance its conformance to the standard.
The significant characteristic of interest in Think C 4.0 is not the familiar set of virtues but the novel object extensions. Symantec has integrated the object-oriented features in the style of C++ rather than Object Pascal. Whereas Object Pascal adds a new data type to Pascal, called class (loosely based on the concept of a record), Think C and C++ provide object-orientation by extending an existing data type called STRUCT.
Because Think C is a subset of standard C++, C++ code will generally not compile with the Think C compiler. On the other hand, Think C code is compatible with C++ compilers. This distinction is particularly significant, because Apple has announced a version of C++ for MPW. Think C is also different from C++ in that the Think compiler itself handles the new object-oriented programming constructs, whereas in classic C++ a pre- processor (a C++-to-C translator) prepares the code for delivery to a standard C compiler.
The value of the C language extension depends on ease-of-use and the quality of the included class libraries of objects. On the first point Think C has no problems. On a Mac II it can compile and link 500K worth of new project source code distributed over 80 files of program main code and predefined objects in less than five minutes. If you make changes to a handful of objects, the project will recompile in ten seconds or so. On the second point Think C has no problems either. Gregory Dow has written a class library full of objects that are models of programming style (see “Showing Some Class”) and that themselves offer facilities that allow fast and flexible construction of serious Mac applications. Several example projects, from simple programs with dummy menus to an almost full-scale MacPaint clone, are included as application frameworks and as tutorials.
Seiter, Charles. (February 1990). Think C 4.0. Macworld. (pg. 182).
Symantec THINK C version 4.0 from 1989.
Comes on four 800KB floppy disk images.