Bjarne Stroustrup Reveals All On C++
An anonymous reader writes "Bjarne Stroustrup, the creative force behind one of the most widely used and successful programming languages — C++ — is featured in an in-depth 8-page interview where he reveals everything programmers and software engineers should know about C++; its history, what it was intended to do, where it is at now, and of course what all good code-writers should think about when using the language he created."
Print Version of the same article http://www.computerworld.com.au/index.php/id;408408016;fp;16;fpid;1;pf;1
It's always cool to see this kind of interview. It's even cooler when you can read it all on one page rather than 8.
I suggest that anyone who uses C++ or is interested in the history of programming read this. Some of it is a bit banal, like how they chose the name, but some of it is really intersting. RTFA for once, you lazy clods!
Most of your complaints seem aimed at C and not C++. Let's see:
* No standardized pragmas
You want standardized *compiler extensions*?They standardized the extension mechanism. That sounds good for a start, but I don't see how you could go farther.
* Macros after-thought and not type safe C compatibility, basically deprecated now as they also affect everything, including members, variables, anything that gets #included, etc. * No 24, and 32 bit (unicode) chars wchar exists, toghether with I/O stuff, though I'm not sure about the encoding type. You can even declare streams and strings for any character type you build. * Still has float / double crap, instead of being properly deprecated and f32, f64, f80 used instead* Still has short / long crap, instead of being properly deprecated, and i8, i16, i32, i64, i128, u8, etc... C compatibility. I believe they are inheriting the new types from C99 too.
Also, short/int/long give you the sizes optimized for the specific processor, so you can use that if that's what you want. You can't really deprecate them because of that * No distinction between typedefs and aliases What on earth is an alias? Are you talking about C's struct namespace? (one of the few things that C++ doesn't inherit) * Inconsistent left-to-right declarations Inconsistent in what sense? * Compilers still limited to ASCII source C++ has included trigraphs for over ten years now, which allow an editor to insert any unicode character and still store everything in ASCII for compatibility. Compilers don't even need to support unicode for things to just work. The editor just has to interpret the trigraphs and paint them on screen as the appropriate character.
I've never used them though.
* No binary constant prefix (even octal has one?!) I've never met anyone who actually worked in binary. Hex is close enough and less error-prone. Octal probably got included for a) C compatibility and b) People did use to work in octal (see file access permissions) * No standard way to assign NaN, +Inf, -Inf to floating point constants at compile time Would you like a quite or signaling NaN?For double:
#include <limits>
const double inf = std::numeric_limits<double>::infinity ();
const double minf = -std::numeric_limits<double>::infinity ();
const double nan = -std::numeric_limits<double>::signaling_NaN();
See more here for example.
There are has_infinity() and related functions to check for a type's capabilities (say, in a template)