Slashdot Mirror


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."

11 of 371 comments (clear)

  1. Normal Read by MoonlightSeraphim · · Score: 5, Informative
  2. Interesting Read by dreamchaser · · Score: 5, Informative

    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!

    1. Re:Interesting Read by c · · Score: 3, Informative

      Early C++ "compilers" usually did more than just macro processing, but only just; most of them were implemented in terms of translating C++ to equivalent C code and then compiling the resulting C. Not so elegant, but it allowed compiler vendors to pick the low-hanging fruit and get something on the market ASAP.

      It wasn't just commercial compilers, either. g++ worked that way.

      Of course, it goes without saying that these early C++ compilers sucked hard.

      c.

      --
      Log in or piss off.
  3. And ... by LizardKing · · Score: 4, Informative

    ... for an equally partisan view from another perspective, the C++ FAQ.

  4. Love C++, but it still sucks... by UnknownSoldier · · Score: 4, Informative

    * No standardized pragmas
    * Macros after-thought and not type safe
    * No 24, and 32 bit (unicode) chars
    * 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...
    * No distinction between typedefs and aliases
    * Inconsistent left-to-right declarations
    * Compilers still limited to ASCII source
    * No binary constant prefix (even octal has one?!)
    * No standard way to assign NaN, +Inf, -Inf to floating point constants at compile time

    1. Re:Love C++, but it still sucks... by PhrostyMcByte · · Score: 4, Informative

      * Pragmas are made specifically for non-standard compiler extensions. There can be no "standard" pragmas.
      * C++0x is adding support for UTF-8, UTF-16, and UTF-32 character types and literals.
      * TR1 adds cstdint which includes int32_t etc. types.
      * NaN and +Inf (not -Inf, though) can be had from std::numeric_limits

      alas, if those are the first complaints you think of, you haven't been using C++ long enough to really know the painful bits.

    2. Re:Love C++, but it still sucks... by Eponymous+Bastard · · Score: 5, Informative

      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)

  5. Re:Use this link to read article on one page by PhrostyMcByte · · Score: 4, Informative

    The developer should know if he'll need the size of an array or not. Which is why there is a convenient std::vector and std::tr1::array for when you do want the size. Not forcing you to carry around a size is a feature, not a bug - if you don't need the size, it's just a waste of space.

    And auto_ptr is likely to be depreciated in C++0x, with unique_ptr and shared_ptr replacing it.

  6. Anyone trying to defend C++ as a language by frank_adrian314159 · · Score: 3, Informative

    Anyone trying to defend C++ as a language should read this. And I speak as a programmer who has used C++ since cfront 1.0 was released to the world.

    Useful, yes. Pragmatic, maybe. Design heavily rationalized ex post facto by its creator and its proponents, most certainly. But a well-designed programming language, it is not.

    --
    That is all.
  7. Re:useful but oh so flawed by pclminion · · Score: 3, Informative

    Good book, but I don't see how some minor nuances translate to insurmountable design flaws. It's true that proper use of C++ requires a level of expertise beyond what's required for many other languages. IMHO, that just makes real C++ programmers more valuable.

  8. Re:yawn by shutdown+-p+now · · Score: 3, Informative

    All languages have "implementation details" and various gotchas.
    It's true, but some have more, and others have less, and C++ is on the "a fucking lot" end of the spectrum. Of all the languages I know, the only one that has more (mostly because it covers a lot more ground) is Common Lisp.