C Programmer's Disease = C = calculator

C++ /C'-pluhs-pluhs/ n.

Designed by Bjarne Stroustrup of AT&T Bell Labs as a successor to C. Now one of the languages of choice, although many hackers still grumble that it is the successor to either Algol 68 or Ada (depending on generation), and a prime example of second-system effect. Almost anything that can be done in any language can be done in C++, but it requires a language lawyer to know what is and what is not legal-- the design is almost too large to hold in even hackers' heads. Much of the cruft results from C++'s attempt to be backward compatible with C. Stroustrup himself has said in his retrospective book "The Design and Evolution of C++" (p. 207), "Within C++, there is a much smaller and cleaner language struggling to get out." [Many hackers would now add "Yes, and it's called Java" --ESR]

--Jargon File, autonoded by rescdsk.

A lesser-known smiley or emoticon, one of the rarer variety which are intended to be viewed the right way up, rather than on their side. This symbol represents a person who has been knocked out cold, and had his/her left ear removed. Given the gruesome subject matter, this emoticon is rarely used in polite society.

As any C programmer knows, "C++" means "increment C, but use its old value".

For precisely this reason, most C++ programmers deprecate the use of C++ for most purposes, preferring "++C", which can often avoid creation of a temporary.

Regardless of the semantic confusion surrounding the name of the programming language, modern C++ is probably best seen as a "multi-paradigmatic" "no overhead" language.

The OOP features of C++ are probably best-known. Here, too, the "no overhead" rule shows up: virtual functions, polymorphism, and dynamic typing can be used, if explicitly requested. That's because they carry a run time overhead when used. This sets C++ apart from other OO languages like SmallTalk and Java; practitioners of those languages would probably regard only polymorphic inheritance as inheritance. C++ has its uses for non-polymorphic inheritance, creating a more complex language. It's also harder to use, because several OO paradigms are supported, and the programmer must be aware which is in use where.

C++ also supports generic programming. With the STL, C++ can be used as "a better C". But the STL is extensible to use not just its containers and iterators with your algorithms, but also its algorithms with your containers and iterators! All with the "no overhead" rule in place and stronger type checking than is usually possible in container libraries. A vector<C> is not a vector<Object> for some "Object" base class that all objects inherit from. Read more about this: a list of Cars is not a list of Vehicles!

Entirely or almost by accident, the generic programming features of C++ are enough for template meta-programming. The blitz++ numeric library is the best-known examplar of this emerging paradigm.

A synthesis of the various paradigms is now emerging. Andrei Alexandrescu's Modern C++ Design is a superb example of how metaprogramming can be used to implement various design patterns (generically, of course). The "no overhead" rule means you only pay for those features you use; a well-designed application written in C++ will run as well as if it had been written in any other language.

On the other hand, the rampant complexity of the mixture of paradigms exacts a heavy price. The language itself is very complex; features from the different paradigms mix in complicated ways. As a result, there are essentially no mainstream compilers for ISO C++. Understanding modern C++ code requires that the programmer understand not only the features but their uses, in combination with each other, for various patterns. (On the positive side, STL is significantly simpler than similar libraries for other languages and earlier C++ libraries, showing that good design helps here too.)

Why C++ sucks and the C++ programming language freakshow are somewhat less reverent looks at this very topic.

The following are different ways to say "add one to variable c" in various programming languages.
They assume that you are not working near the limits of the datatype: that you are using either relatively small numbers (i.e. not close to 231 on a 32-bit system) or bignum (arbitrary precision integer) variables.

Contributions from readers:
  • Pascal: c := c + 1; (from silencio)
  • Ada 95: c = c + 1; (from silencio)
  • Borland Pascal and Delphi: c := c + 1; or inc(c); (StrawberryFrog)
  • Java with java.math.BigInteger: c.add(BigInteger.valueof(1)); or (in 1.2 or later) c.add(BigInteger.ONE); (from N-Wing)
  • Forth: C @ 1 + C ! (think "C fetch 1 add C store") (from ariels). "If you want to keep the value of C on the stack (i.e. "C++" as opposed to "++C"), you'd of course just say C @ DUP 1 + C !".

(/msg me with more)

Hello World in C++:
#include <iostream>
using std::cout;

int main()
  cout << "Hello world" << endl;
  return 0;

This is the genealogy of the programming language C++:

C++ is a child of C with Classes.
C++ was born in year 1983.
Then it begat Java in year 1991.
It became C++ ANSI/ISO in year 1998.
Then it begat C# in year 2000.
Then it begat Internet C++ in year 2000.

This genealogy is brought to you by the Programming Languages Genealogy Project.

The early development of C++ and its transition from C with Classes was, in a way, a rather informal process between Stroustrup, his peers and the users. There was never a design commitee, or a design paper - the design, documentation and implementation all went on at the same time (the next time your boss or teacher insists on massive amounts of planning and design, tell him/her about C++).

C with Classes eventually became known as C++ through a somewhat long process. At first, the management at Bell Labs requested the language be named C84, because people had taken to referring to C with Classes as "new C" and later just "C". This led to them calling traditional C "old C", which was considered insulting.

The name C84 was eventually dropped because, well, it sucked. It was ugly and institutional, and this was exactly the image Stroustrup didn't want for his new language. The name C++ was eventually picked because it had meaning within the language and was generally a nice pun-type thing.

Although, as noted, no formal design took place for C++, Stroustrup details in his book The Design and Evolution of C++ the general rules he kept in mind while implementing C++. He hastens to point out, however, that where practical experience and rule disagreed, practical experience always won. He was keen to create a language that was of genuine use in solving real-world programs, not an academic plaything.

Aims of C++:

  • C++ should make programming enjoyable for serious programmers.
  • C++ should be a general-purpose language that improves on C, supports data abstraction, and supports object orientation.
General rules for the evolution of C++:
  • C++ must be useful in tackling real-world problems.
  • C++ must be useful now, not several years down the line.
  • C++ should not be a useless quest for perfection - sacrifices have to be made when solving real-world problems.
  • Every feature must be reasonably obvious to implement, so potential compiler implementators are not discouraged.
  • When adding a new feature or changing an existing one, a transition path should always be provided.
  • Programmers should not be forced to do things what is considered the "right" way, but should have freedom to do as they wish.

C++ has (If I counted correctly) 74 keywords as opposed to the 32 C keywords. In the following alphabetical list, unmarked words are as in C, + marks a new keyword for an old C concept, and * marks something totally new in C++.

+and +and_eq asm auto +bitand +bitor +bool break case *catch char *class +compl const *const_cast continue default *delete do double *dynamic_cast else enum *explicit *export extern +false float for *friend goto if inline int long *mutable *namespace *new +not +not_eq *operator +or +or_eq *private *protected *public register *reinterpret_cast return short signed sizeof static *static_cast struct switch *template *this *throw +true *try typedef *typeid *typename union unsigned *using *virtual void volatile *wchar_t while +xor +xor_eq

Many of the new C++ features required new keywords, so some of these keywords are quite interesting. The new keywords are (sorted by use):

I believe each of these new keywords has its own node now.

Log in or register to write something here or to contact authors.