Home
Main website
Display Sidebar
Hide Ads
Recent Changes
View Source:
C++
Edit
PageHistory
Diff
Info
LikePages
You are viewing an old revision of this page.
View the current version
.
A ProgrammingLanguage. Stroustrop decided that C was a neat idea, but needed more syntatic sugar. C++ has all the power and flexibility of C, with all new disadvantages. Some of these disadvantages include: * More type-safe meaning the compiler picks up more errors. * Generic and type-safe programming via templates. * Object orientation via 'virtual' functions and (multiple) inheritance. * The StandardTemplateLibrary, or STL. * iostreams as a replacement for printf(3). * The string class not being fully compatible with (char *), so they are useless for lots of io. eg istream::getline(char *, size_t) needs a character buffer, and can't take a string. same with read(char*, size_t) and get(char*, size_t); What is the point?! * Creating a string with numbers in it from variables is awful - it's easier to revert back to C: char buffer[[16]; snprintf(buffer,15,"output-%n.txt", counter); is more logical than strstream ss; ss << "output-" << counter << ".txt" ; string s; ss >> s; No, they're the new syntatic sugar. :) Some of them are very very nice. The all new disadvantages include: * Your compiler will SegFault regularly instead of giving meaningful error reports when you stuff up a template definition * You still have to manage memeory, but now it's harder to figure out who's doing what since it's all hidden behind syntatic sugar (Stroustrop thought that [Simula67 | http://www.cetus-links.org/oo_simula.html] was a neat idea, but a garbage collector was "too slow". So he designed his own perfect object-oriented language that didn't have one. I'm not sure what he was thinking.) (The we have to get him to hook us up with his Supplier, he's obviously getting the Good Stuff) As an example of template-based (in this case the STL) error reports in C++: /usr/include/stlport/stl/_hashtable.h: In method `size_t _STL::hashtable<_STL::pair<const CActionHandler::Keycode,void __<snip>__ /usr/include/stlport/stl/_hashtable.c:347: instantiated from `_STL::hashtable<_STL::pair<const CActionHandler::Keycode,void (CActionHandler::*)()>,CActionHandler::Keycode,_STL::hash<CActionHandler::Keycode>,_STL::_Select1st<_STL::pair<const CActionHandler::Keycode,void (CActionHandler::*)()> >,_STL::equal_to<CActionHandler::Keycode>,_STL::allocator<_STL::pair<const CActionHandler::Keycode,void (CActionHandler::*)()> > >::resize(unsigned int)' /usr/include/stlport/stl/_hashtable.c:169: instantiated from `_STL::hashtable<_STL::pair<const CActionHandler::Keycode,void (CActionHandler::*)()>,CActionHandler::Keycode,_STL::hash<CActionHandler::Keycode>,_STL::_Select1st<_STL::pair<const CActionHandler::Keycode,void (CActionHandler::*)()> >,_STL::equal_to<CActionHandler::Keycode>,_STL::allocator<_STL::pair<const CActionHandler::Keycode,void (CActionHandler::*)()> > >::_M_insert(const _STL::pair<const CActionHandler::Keycode,void (CActionHandler::*)()> &)' /usr/include/stlport/stl/_hash_map.h:188: instantiated from here /usr/include/stlport/stl/_hashtable.h:557: no match for call to `(const _STL::hash<CActionHandler::Keycode>) (const CActionHandler::Keycode &)' You will notice the above actually has quite a few lines removed for brevities sake. Perhaps a good reason to stay away from C++ and program in [INTERCAL] or [PASL] (or [Java]! - Jared). Or to program in something like [Ocaml | http://www.ocaml.org], which has parametized types, classes and modules, which cover all the possible uses of C++ templates in a saner manner, AFAICT. --GlynWebster
64 pages link to
C++
:
EricHopper
wxWidgets
UndefinedSemantics
STLPort
MarcelVanDeSteeg
CastingPointerToFunction
InLining
Bison
Boost
OCaml
PolymorphicTypes
Qt
Pointer
Java
WaikatoCourseDescriptions
KDevelop
BjarneStroustrup
JavaNotes
GeoffCant
BungGameEngine
gcc(1)
VisualC++
NULL
TimCareySmith
mcheck
NameSpace
JavaDebuggingHints
GimpToolKit
TurboPascal
CorporateProgramming
LinkedList
VisualStudio
StandardTemplateLibrary
ObjectOrientation
Eclipse
ToolKit
ReligiousWar
SCons
C
GCC
Variable
CraigMckenna
ML
Synchronisation
StaticallyTyped
Library
BufferOverflow
StrictEvaluation
SamMcKoy
GarbageCollection
Kate
MakeWhatIs
Algol
Valgrind
DeBugging
DataType
Carbon
JavaAndC++
GerwinVanDeSteeg
ProgrammingLanguage
HelloWorld
-Wall
SamJansen
GianPerrone