C++

C++ , by Bjarne Stroustrup , is a general-purpose programming language with a bias towards systems programming, intended to be a successor to C.

Quips

C++ is "the tool of the angels: only in heaven you have infinite amount of time to devote to design analysis (and to wait for the compiler to finish).
Marco Maggi
C++ doesn't just provide you with enough rope to hang yourself. It also provides a do-it-yourself scaffold (with instructions translated from Klingon by Papuan tribesmen). ... Experts can do very cool stuff with C++. Utter dummies can do cool stuff with C++. But everyone else is in trouble...
- dkf, Tcl Chatroom

See Also

Critcl does C++
Invoking C commands from C++
Invoking Tcl commands from C++
Cplusplus streams and Tcl channels
Anjuta
Ara
Artefact
AutoDOC
C++/Tk
CmdLine
cpp2itcl
cpptcl
Deet
Empact Foundation Class Library
A mature cross-platform C++ library for use as a default application framework. Features include:
  • Threading & synchronization
  • Socket programming: SSL, NanoMsg & ZMQ
  • File I/O utilities: zlib, ini, yaml
  • Native Database access: MySQL, SQLite, BerkleyDB, Postgre, REDIS and ODBC
  • Built-in mini XML parser; optional EXPAT, LIBXML and MSXML support
  • Network protocol stack: HTTP, FTP, SMTP, POP3, SOAP, XMLRPC
  • Scripting languages: Perl, Python, JavaScript, VBScript, Java, Lua, Tcl, Squirrel
  • Cloud Computing: AWS
  • Encryption: OpenSSL
  • Platforms: Linux/Posix, Windows, Arduino
EvoX
Exuberant Ctags
FriGUI
J
JX Development Suite
MyrmecoX
Nebula Device
NSCL SpecTcl
Objectify
OBST
plplot
robodoc
Sdoc
SNACC
Source Navigator
SQL Relay
Swig
tlist , by Mark Smith
A "C++ class for a Tcl list ... [which] makes it easy to use Tcl lists within a C++ program."
Tsert Integrated Test Environment
Webcpp

Reference

ISO/IEC 14882 , Second Edition, 2003
Making C++ Loadable Modules Work
A helpful guide to problems that can arise when writing Tcl extensions in C++. Written in 1998, so its documentation on the limitations of some compilers may be out of date.
Why C++ is not just an Object-Oriented Programming Language , Bjarne Stroustrup
C++ directly supports a variety of programming styles. In this, C++ deliberately differs from languages designed to support a single way of writing programs.
So templates are overloading, right?
The insanity that is modern (templatized) C++.
C++ Frequently Questioned Answers
Harsh critique of C++ and its FAQ.

Guides

IOS/IEC 14882, Final Committe Draft
A freely-available draft of the final specification. The official specification is available from ANSI for $60, ]

Resources

Bjarne Stroustrup's homepage
JTC1/SC22/WG21 - The C++ Standards Committee - ISOCPP
The ISO/IEC working group that continues to evolve C++.
C++ , Dr.Dobb's

Tools

underC
An interesting lightweight C++ interpreter. The author implies that it should be easy to interact with Tcl/Tk from it.

Opinion

Amplifying C , Andreas Fredriksson, 2010-01-22
States that templating, RTTI, and classes that have to be declared in headers are fundamental flaws of C++, and that the way forward is something akin to Lisp over C. Ahem.
Why should I have written ZeroMQ in C, not C++ (part I) , Martin Sústrik, 2012-05-10
Some replies include suggestions to use C++-11 or C++-14 and to use C facilities as needed.

Description

ISO/IEC 14882:2011, or '''C++ 11', is the latest published standard specification of C++. The update specification includes:

  • Move semantics
  • Smart, shared pointers
  • Hash tables
  • Regular expressions

DKF: Tcl is not written in C++, but rather in C. This is not about to change, as it remains relatively difficult to do extremely portable ABIs in C++ due to the exact details of how compilers convert source code into object code; the tendency with C++ is to spread implementation details across class boundaries at the ABI level, which is a bit faster but also far more entangling. As such, Tcl sticks with C (and in fact a very codified and restricted type of C at that); in engineering terms, we're very conservative.

What we would like to be able to do, but can't at the moment, is unequivocally recommend a library for people who do want to mix modern Tcl and modern C++…


willdye If you're searching for references to C++, then you might want to also search for strings such as "cpp" or "cplusplus". The "++" characters are problematic in certain situations, so the name "C++" has many synonyms.


AMG: Aside from interoperability with already-existing C++ packages, what compelling applications (uses) for the C++ language are there?

It seems to me that most of C++ seems to be syntax sugar for stuff already present in C, for example: const (#define, enum), iostreams (printf), templates (#define), classes (struct), exceptions (return codes, errno, longjmp), virtual functions (function pointers), weird casting (straightforward casting), bool (int), // (/*...*/), references (pointers), new/delete (malloc/free), and so on.

Any actual innovation in C++? What can be done in C++ that can't be done in C?

How about function overloading and defaulted arguments? In C, I'd just embed the argument type signature into the function name, such as is done in OpenGL.

Operator overloading? I just make functions with names describing the operation being performed, e.g. "add".

Namespaces? Prefix the function or variable name, and now no one can do "using namespace" in a header file. Or use static for file scoping.

Speaking of static, what about static local variables with non-constant initializers? C++ allows this, but it has to implement it using guard flag variables that get checked all the time. The same can be done explicitly in C, but the fact that the programmer has to put them there makes him/her aware of their existence, so they're likely to look for a more efficient approach, not to mention do things in a thread-safe manner.

Or global variables with non-constant initializers? Like the above case, now the programmer has lost control over the order of initialization. Having things be automatic is nice when it works, but controlling the order of initialization strikes me as terribly important.

And so forth... Basically, I just get less and less comfortable with C++ as time goes on, the more I find that C already had the answers in a way that's simpler and more portable.

C's incomplete types, for example, seem to be more effective at data hiding than C++'s protected and private members, which become part of the ABI despite the compiler asking you to not use them (at least, not until you do "#define private public").