Chapter 11. Objective C

Objective C is a relatively small object oriented extension of C. The model for the object oriented features is Smalltalk (in contrast to C++ which combines C with Simula's classes). It was developed by Brad Cox and the StepStone corporation in the early 1980's. The biggest applications written in Objective C are probably NeXTstep/OpenStep (which now turned into Apple's Mac OS X) and WebObjects, an early and much acclaimed web application server also developed by NEXT and now owned by Apple. The developers I know who used WebObjects and Objective C keep raving about the much more elegant and powerful language when compared to C++. Enough reasons to have a closer look at Objective C.

11.1. Software and Installation

The GNU compiler gcc supports Objective C. It is also the one used by the Apple system. The compiler automatically recognizes the .m suffix of an Objective C source file. If you use the emacs editor, it will also automatically use the Object C major mode for editing .m files. For the examples, I'm using gcc version 3.0 on a Linux (Debian) system. To compile the test programs, we simply apply gcc to the source file and obtain the standard UNIX executable a.out (of course, you can also choose another name for the executable using the -o option). On some systems, you may need to add the libraries for Objective C and threads manually using the linker flags -lobjc -lpthread.