Background information
For a good description of the C language, see: http://en.wikipedia.org/wiki/C_programming_language
The article on CeePlusPlus is at http://en.wikipedia.org/wiki/C%2B%2B
For a good description of the Object Oriented concept, see: ObjectOrientedForDummies; EncapsulationForDummies
Pros
- This is the closest to a UniversalProgrammingLanguage as any ProgrammingLanguage is. There are C++ programmers in every country in the world. If you start an application in C or C++, chances are you won't spend 10 years looking for a programmer who can continue it.
- C++ is a MultiParadigmProgrammingLanguage spanning a broad range of LevelsOfAbstraction. You can use it as portable AssemblyLanguage like CeeLanguage, you can do OO with classes, or you can do template MetaProgramming at a much higher level of abstraction than most other languages. I wonder what these "most" other languages are...
- It creates native executables. No need to have an interpreter around. You receive the program and it's ready to run. Though you may need to have all the right versions of all the right shared libraries.
- You can port it to any OS with just minor modifications if you stick to the very strict confines of the CeePlusPlus standard.
- ... but it is difficult to write a non-trivial program this way. In particular, you get no support for graphics, concurrency, synchronization, networking, I/O (other than what stdio provides), multimedia, etc.
- It can be solved by Using portable libraries such as AdapativeCommunicationEnvironment?, OpenGraphicsLibrary?, and many others. Think about how other portable languages can be implemented using C/C++.
- It is quick, lightning speed sometimes (AsFastAsCee); but I am told this has nothing to do with the language but more to do with the way the programmer has built his code.
- It has to do with the following:
- Large number of highly-optimized compilers avaiable
- It compiles to native code, not ByteCode
- Low-level programming contructs enable lots of ad-hoc, programmer-specified optimizations that simply cannot be coded in a higher-level language
- Many feel that including such optimizations (especially without profiling telling you they are needed) is poor design practice.
- In theory, a SufficientlySmartCompiler could produce similar levels of optimization on a higher-level language; in practice such compilers don't exist (or are unsuitable for production use).
- StaticTyping. DynamicTyping is wonderful for lots of things (this is not an anti-DynamicTyping rant), but it imposes a performance penalty.
- Arguably, the lack of GarbageCollection improves performance. (Many advocates of GC dispute this. Unfortunately, most production languages which do use GarbageCollection also use VirtualMachines, so an apples-to-apples comparison is difficult here). The lack of GarbageCollection is also important when memory is limited (for example, on game consoles) because efficient garbage collectors have a much larger memory overhead than a good manual allocator.
- That said, for many applications being AsFastAsCee is simply unnecessary; and use of a higher-level language is a better choice (from an economic perspective; which is one that can be measured somewhat). For some applications, C++ is indeed a better choice. MooresLaw will likely cause the set of applications where C++ is the optimal choice to shrink--it has been shrinking for years now, though some SmugSmalltalkWeenies will tell you that it has always been the empty set. :)
Cons
- This is a difficult language; it's hard to learn, hard to practice.
- It does not hook, connect to modern-day databases such as MYSQL easily.
- Any non-trivial program will also be non-portable without a lot of extra work.
- This is recognized in the development of reusable components portable to different systems, e.g. BoostLibraries.
- It is not considered an internet-friendly programming language because of its poor string handling capability. Buffer overflow exploits are common in C programs, and nearly impossible in higher level languages. See CeeLanguageAndBufferOverflows. (I think this is more applicable to CeeLanguage than C++ since you can use StandardTemplateLibrary's string class to avoid that)
- C++ doesn't have built-in automatic memory management. (but see GarbageCollectionInCpp)
- Researchers and anecdote both suggest that programmers are much less productive in C/C++ than in Java or other HighLevelLanguages. See also GreenspunsTenthRuleOfProgramming. Such comparisons also tend to reflect badly on Java (a close cousin to C++), though not quite as a badly as C++.
- It does not support generalized overloading [see http://www.research.att.com/~bs/whitespace98.pdf]
- Large C++ projects often have long build times. Some causes are textual includes (unless you are very disciplined and/or work hard to minimize dependencies), heavy use of templates, and large amounts of debug information that get produced.
See CeePlusPlusReigns
CategoryCpp