next up previous print clean
Next: Notes and comments Up: Why Java? Previous: Fortran

C++

C.A.R. Hoare said that he did not know what the language of the year 2000 would look like but that it would be called Fortran. We know today that Hoare was wrong: Today, C replaces Fortran in both universality and uniformity. More young engineers and scientists learn C than any other language. UNIX, the operating system of most scientific computers, is implemented in C. C overcame the memory-allocation limitation of Fortran77, and offered new features such as data structures and scope.

C was standardized, and new developments have centered on the C++ language. C++ extends C but adds object oriented features. C++ has grown rapidly. It already has many more users than Fortran90 (). We find C++ compilers on all manner of computers (also the free GNU compiler). However, C and C++ lack the performance of Fortran77 even they are often comparable to Fortran90 .

However, the C++ language is difficult to learn and error-prone because of the lack of automatic garbage collection and the addressing of objects through pointers. Multiple inheritance is possible in theory but is best avoided according to experts. I feel about C++ as Dijkstra  feels about Algol60: it allows the programmer so much combinatorial freedom that its confident use requires a strong discipline from the programmer. Besides being expensive to implement it seems dangerous to use.

Garbage collection: C++ burdens the programmer with explicite memory management. If a programmer does not free an object's memory after it has outlived its usefulness, the memory will not be available to the program until the program exits. Since in an object-oriented language the allocation of resources and the dependencies between objects can be hidden, garbage collection by the programmer is prone to error and potentially wasteful. In contrast, Java automatically frees memory allocations that the program does not address anymore. However, if desired, a Java programmer can explicitely disallocate memory (and other resources).


next up previous print clean
Next: Notes and comments Up: Why Java? Previous: Fortran
Stanford Exploration Project
3/8/1999