Penguin
Annotated edit history of C++ version 23, including all changes. View license author blame.
Rev Author # Line
22 AristotlePagaltzis 1 A ProgrammingLanguage developed by BjarneStroustrup as the successor to [C], keeping all of its power and flexibility, adding all new disadvantages. It's an almost-superset of its predecessor and adds ObjectOrientation, [Template]s and NameSpace~s.
19 AristotlePagaltzis 2
3 ----
4
5 !!! Advantages
6
7 * Strict typing so the [Compiler] picks up more errors.
8 * Typesafe generic programming via [Template]s, and a standard library of them, the [STL].
22 AristotlePagaltzis 9 * NameSpace~s to help avoid symbol name collisions between independent pieces of code.
19 AristotlePagaltzis 10 * Code reuse via ObjectOrientation.
11 * iostreams as a replacement for printf(3).
12
13 ----
14
15 !!! Complaints
16
17 !! String class
18
22 AristotlePagaltzis 19 What's the point of a string class if it's not fully compatible <tt>char *</tt> and is therefor useless for many [I/O] operations? Eg. you need a character buffer and can't pass a string object to
19 AristotlePagaltzis 20
22 AristotlePagaltzis 21 * <tt>istream::getline(char *, size_t)</tt>
22 * <tt>read(char*, size_t)</tt>
23 * <tt>get(char*, size_t)</tt>
24 * ... and the list goes on.
19 AristotlePagaltzis 25
26 !! Variable interpolation
27
28 Interpolating variables into strings is absolutely hideous and easier done by reverting back to [C]. Compare:
29
22 AristotlePagaltzis 30 <verbatim>
31 // C way
32 char buffer[16];
33 snprintf(buffer,15,"output-%n.txt", counter);
19 AristotlePagaltzis 34
22 AristotlePagaltzis 35 // vs
19 AristotlePagaltzis 36
22 AristotlePagaltzis 37 // C++
38 strstream ss;
39 string s;
40 ss << "output-" << counter << ".txt" ;
41 ss >> s;
42 </verbatim>
19 AristotlePagaltzis 43
44 !! GarbageCollection (not)
45
22 AristotlePagaltzis 46 Since BjarneStroustrup liked [Simula67 | http://www.cetus-links.org/oo_simula.html] but decided GarbageCollection was "too slow", he designed his own perfect language with ObjectOrientation but no GarbageCollection. Quite a few people will readily assume he must have been on crack. Besides having to manage memory yourself, you now have to cope with new syntactic sugar that can conceal which part of your code is responsible for what bits on your heap. Great fun -- really!
20 SamJansen 47
48 ''Whoever wrote this last paragraph needs to smoke less crack themselves.'' -- SamJansen
19 AristotlePagaltzis 49
50 !! [Template]s
51
52 Your compiler will segfault regularly instead of producing error reports when you stuff up a [Template] definition. When it does produce an error report, it looks like the (drastically snipped down) one below (in this case it's from the [STL]).
53
22 AristotlePagaltzis 54 <pre>
55 /usr/include/stlport/stl/_hashtable.h: In method `size_t ~_STL::hashtable<_STL::pair<const CActionHandler::Keycode,void
56 __<snip>__
57 /usr/include/stlport/stl/_hashtable.c:347: instantiated from `_STL::hashtable<_STL::pair<const CActionHandler::Keycode,void
58 (CActionHandler::*)()>,CActionHandler::Keycode,_STL::hash<CActionHandler::Keycode>,_STL::_Select1st<_STL::pair<const
59 CActionHandler::Keycode,void (CActionHandler::*)()> >,_STL::equal_to<CActionHandler::Keycode>,_STL::allocator<_STL::pair<const
60 CActionHandler::Keycode,void (CActionHandler::*)()> > >::resize(unsigned int)'
61 /usr/include/stlport/stl/_hashtable.c:169: instantiated from `_STL::hashtable<_STL::pair<const CActionHandler::Keycode,void
62 (CActionHandler::*)()>,CActionHandler::Keycode,_STL::hash<CActionHandler::Keycode>,_STL::_Select1st<_STL::pair<const
63 CActionHandler::Keycode,void (CActionHandler::*)()> >,_STL::equal_to<CActionHandler::Keycode>,_STL::allocator<_STL::pair<const
64 CActionHandler::Keycode,void (CActionHandler::*)()> > >::_M_insert(const _STL::pair<const CActionHandler::Keycode,void
65 (CActionHandler::*)()> &)'
66 /usr/include/stlport/stl/_hash_map.h:188: instantiated from here
67 /usr/include/stlport/stl/_hashtable.h:557: no match for call to `(const _STL::hash<CActionHandler::Keycode>) (const
68 CActionHandler::Keycode &)'
69 </pre>
19 AristotlePagaltzis 70
23 AristotlePagaltzis 71 This is perhaps a good reason to stay away from [C++] and program in [INTERCAL] or [PASL]. Or maybe [Java] (see [JavaAndC++]). Or in something like [OCaml], which has parametized types, classes, and modules, covering most if not all the possible uses of [C++] [Template]s in a saner manner.
21 JohnMcPherson 72
22 AristotlePagaltzis 73 ----
74
75 !!! See also
76
77 [C++Notes] offers hints on [C++] and [STL] constructs if you can't find a better language to program your application in...
19 AristotlePagaltzis 78
79 -----
80 CategoryProgrammingLanguages, CategoryImperativeProgrammingLanguages, CategorySystemsProgrammingLanguages, CategoryObjectOrientedProgrammingLanguages, CategoryMachineOrientedProgrammingLanguages

PHP Warning

lib/blame.php:177: Warning: Invalid argument supplied for foreach() (...repeated 2 times)