C++: a modern classic

Despite having roots in the 1970s, C++ is as modern as Java or C#, writes Nick Langley

Despite having roots in the 1970s, C++ is as modern as Java or C#, writes Nick Langley

What is it?
C++ is confusingly described as a mid-level language. This does not mean it is less rich than high-level languages such as Cobol, but that it allows you to fiddle with bits and bytes to create an application that makes more efficient use of machine resources.

Where did it originate?
Bjarne Stroustrup of AT&T Labs began working on C++ in 1979. The first commercial implementation of the language arrived in 1985. Stroustrup explains, "C++ is a direct descendant of C that retains almost all of C as a subset. C++ is 'a better C' in the sense that it supports the styles of programming done using C, with better type checking and more notational support, without loss of efficiency."

What's it for?
Although it is often described as "object-oriented C", C++ is in fact a "multi-paradigm" language that supports different styles of programming depending on the requirements of the task.

What makes it special?
Stroustrup responds angrily to suggestions that C++ is a less modern language than Java or C#. "Both Java and C# are rooted in 1980s-style object-oriented programming to an even greater extent than early C++ was," he says.

"Since 1987, the focus of development of C++ and its associated programming styles has been templates, static polymorphism, generic programming, and multi-paradigm programming. This is way beyond the scope of the much-hyped proprietary languages."

How difficult is it?
There is no need for newcomers to learn C first. The path from C++ primer to advanced skills requires about 12 days of classroom tuition spread over six months, with spells of concentrated hands-on experience in between.

"C++ for C programmer" courses take about four days.

Where is it used?
C++ opportunities are declining less quickly than, for example, those for Cobol, although it is definitely losing ground to Java. IBM's San Francisco application architecture was first written in C++, before being rewritten in Java, which IBM says is nearly three times more productive.

What can go wrong?
Stroustrup says, "C makes it easy to shoot yourself in the foot. C++ makes it harder, but when you do it blows your whole leg off."

What does it run on?
C++ is both hardware-independent and operating system-independent, meaning that programs written for one platform should run on any other.

Common mistakes
Stroustrup warns, "Too many people program in styles that belong to the mid-1980s, or even earlier

I cringe when I see C++ programs written as a mess of arrays, macros, casts, and pointers. Such programs appear to be assembly code written using C++ syntax."

What's coming up?
Nothing radical until 2004, according to Stroustrup. "The definition of C++ and the fundamental techniques that it supports are unlikely to change significantly before then," he says.

For free tutorials try www.cplus.about.com/, www.cplus-zone.com/, www.cprogramming.com/tutorial, and www.cplusplus.com/doc/tutorial. For a broader understanding, read Bjarne Stroustrup's book The C++ Programming Language. His paper, Learning Standard C++ as a New Language, with much other material, can be found at www.research.att.com/~bs/homepage.

The C/C++ Users Group (CUG) publishes the C/C++ Users Journal.

The CUG claims to be "the single largest resource for portable code on the planet". There is also the UK-based Association of C and C++ Users ( www.accu.org/).

Rates of pay
Junior C++ programmers' pay starts at about £20,000, while senior C++ programmers command £35,000, or more with mobile experience.

Read more on Software development tools