Forgot your password?
typodupeerror
Programming IT Technology

Interview Update With Bjarne Stroustrup On C++0x 589

Posted by CmdrTaco
from the name-spelling-indicates-language-complexity dept.
An anonymous reader writes "DevX interviewed Bjarne Stroustrup about C++0x, the new C++ standard that is due in 2009. Bjarne Stroustrup has classified the new features into three categories: Concurrency, Libraries and Language. The changes introduced in Concurrency makes C++ more standardized and easy to use on multi-core processors. It is good to see that some of the commonly used libraries are becoming standard (eg: unordered_maps and regex)."
This discussion has been archived. No new comments can be posted.

Interview Update With Bjarne Stroustrup On C++0x

Comments Filter:
  • by snarfies (115214) on Thursday August 21, 2008 @12:00PM (#24690589) Homepage

    I saw the headline and thought I was seeing some 1337 form of "cox."

    huhuhuuhuhuh he said "form."

    • C#++? (Score:3, Funny)

      by WED Fan (911325)
      So we are going to create the unmanaged form of C#?
      • Re:C#++? (Score:5, Insightful)

        by Noodles (39504) on Thursday August 21, 2008 @12:25PM (#24691001)

        Because performance is important to some people.

    • by Anonymous Coward on Thursday August 21, 2008 @12:40PM (#24691251)

      C++ is to C as Lung Cancer is to Lung
    • Re: (Score:3, Funny)

      by ozmanjusri (601766)
      I saw the headline and thought I was seeing some 1337 form of "cox."

      Nah, Stroustrup just decided to save time, so he's included the first buffer overflow in the language's name.

  • Objective C and C++ (Score:4, Interesting)

    by Midnight Thunder (17205) on Thursday August 21, 2008 @12:04PM (#24690663) Homepage Journal

    If anyone has used both Objective-C and current C++, can anyone tell me whether the new specification is a clear improvement on either if these?

    • I can. (Score:5, Funny)

      by bigtallmofo (695287) * on Thursday August 21, 2008 @12:10PM (#24690733)
      Yes.
    • by thermian (1267986) on Thursday August 21, 2008 @12:13PM (#24690781)

      No, not really.

      In fact C++ is barely managing to hold its own any more against C# and Java.

      It's not that C++ isn't good, its just that its harder to do things in it then it is to do those same things in either C# or Java. Harder to do means more expensive, and businesses all over are having to tighten their purse strings.

      I keep finding that for fast number crunching apps, C beats C++, and for less intensive work its usually easier to use Java or C#, or indeed python, then it is to use C++.

      Also, its certainly true to say that in the UK C++ is not anywhere near as useful in terms of getting yourself a job as it used to be.

      • Re: (Score:3, Insightful)

        by bill_kress (99356)

        The more I look at it, Java's Just in time compiler is just about as fast as C++.

        The biggest difference tends to be how you program.

        When you really learn to program OO, you tend to create many small objects that outlive the object that created them.

        In C++, that would mean running thousands of mallocs a second, and having some other random (arbitrary) object delete them later.

        That's not the way to code C++. Since you are constantly required to think of object lifetime, you usually have an object die with th

        • Re: (Score:3, Informative)

          by mdarksbane (587589)

          I still haven't seen anything matching it for real time stuff. Not that I wouldn't mind, at all.

          But writing I don't think I've seen OpenGL code in another language that wasn't incredibly slow. Maybe that's just momentum, but regardless, it's still the state of things.

      • by immcintosh (1089551) <slashdot@ianmcintos[ ]rg ['h.o' in gap]> on Thursday August 21, 2008 @03:59PM (#24694567) Homepage

        No, not really.

        Nothing else in your post either supports, or even directly addresses this assertion.

        It's not that C++ isn't good, its just that its harder to do things in it then it is to do those same things in either C# or Java. Harder to do means more expensive, and businesses all over are having to tighten their purse strings.

        This is the same bullshit that's trotted out there every time this topic comes up, and it's no more true now than it ever was, which is not at all. If you do a little looking around, you'll find very elegant libraries that support every single feature you'll see in ANY other imperative language, and MANY declarative language features to boot. If you're against code reuse and third party libraries on some sort of general principle, then you're kinda missing the whole point of C++.

        I'll be blunt, maybe an ass, maybe a troll, but having used all three of those languages extensively, I can say with almost absolute certainty that the only reason you should be having so much more trouble doing things in C++ (ESPECIALLY as compared to those two languages) is that you're either a very poor C++ programmer or have a pathological aversion to third party libraries.

        In fact C++ is barely managing to hold its own any more against C# and Java.

        Another thing that's been very much in the vogue to say lately, but I just haven't seen any meaningful evidence for. I think Bjarne covered this topic fairly even-handedly in TFA, and if he's to be believed then C++ usage is not suffering like popular belief seems to indicate. The crux of it being that web scripting was never a strong domain of C++ in the first place, and in actual applications programming C++ is still the leader of the pack.

    • by Free the Cowards (1280296) on Thursday August 21, 2008 @12:14PM (#24690791)

      Objective-C is essentially unrelated to C++ in every way. C++0x does not change this fact at all. Comparing the two makes just slightly more sense than comparing C++ and Prolog.

    • by TomorrowPlusX (571956) on Thursday August 21, 2008 @01:29PM (#24692017)

      If you're writing C++, the spec is an improvement. If you're writing Objective-C, you probably don't care because you've already got a great language.

      Also, you'll gnash your teeth because god knows how long it will take for apple to provide a compiler toolchain ( gcc? llvm? clang? ) which supports the new features.

  • by Daimanta (1140543) on Thursday August 21, 2008 @12:08PM (#24690707) Journal

    "control of alignment"

    I'd like chaotic good please

  • by jeffb (2.718) (1189693) on Thursday August 21, 2008 @12:15PM (#24690821)
    ...or, as a former manager explained it, "When C++ is your hammer, everything looks like a thumb."
    • by Xeth (614132) on Thursday August 21, 2008 @12:25PM (#24691005) Journal
      No, no. It's "C gives you enough rope to hang yourself. C++ gives you enough rope to hang yourself and every programmer who comes after you"
      • Re: (Score:3, Funny)

        by JoCat (1291368)

        "C lets you shoot yourself in the foot. C++ lets you reuse the bullet."

    • Re: (Score:3, Insightful)

      by fermion (181285)
      I have written code in low level languages, and written code in high level languages, and find the issue is skill and discipline. To be specific, when on does not know who to use a hammer, then everything does look like a thumb. OTOH, when one codes in Java, everything looks like a condominium. When one codes in C# everything looks like an office park. One advantage of C++ is that it allows some enforcement of rules, but allows the skilled coder to relax those rules when some justified. Again, it requi
  • by rava (618424) <`guillaume.rava' `at' `gmail.com'> on Thursday August 21, 2008 @12:23PM (#24690963)
    There's only one interview with Stroustrup that's worth reading: http://www.nsbasic.com/desktop/info/interview.shtml [nsbasic.com]
  • by Escogido (884359) on Thursday August 21, 2008 @12:29PM (#24691073)

    http://yosefk.com/c++fqa/ [yosefk.com] - this site says it all.

    And it's also being argumentative and verbose at that, unlike your routine 'C++ sucks' rant.

    • Re: (Score:3, Interesting)

      by immcintosh (1089551)

      I looked at that, and at first it seemed, well, this is fair. A lot of these things are drawbacks, and it's pretty well laid out. Then I read into it a little further... and I really have to wonder. A lot of it is just WILDLY exaggerated. I mean, the author clearly tried to blow some minor problems up to ridiculous proportions. Some of the stuff in there is just absurd. Gems like this:

      [8.2] What happens if you assign to a reference?

      FAQ: A reference is the object, so of course you assign to the refer

  • by bsmoor01 (150458) <seth@bBALDWINeere.org minus author> on Thursday August 21, 2008 @12:38PM (#24691209)

    I really, really, really hope a lot of these things are implemented as compiler- or runtime-level features. I understand the purity aspect of implementing features as templates, but it just bloats my code and slows my compile times. A lot of the compile time for my apps is spent regenerating the same template crap over and over, then waiting on the linker to weed out what's duplicated. It takes forever.

  • by serviscope_minor (664417) on Thursday August 21, 2008 @12:46PM (#24691345) Journal

    We will see the usual litany of C++ hating here in this thread. The hating will be generally based around misconceptions or problems that are 5 years old.

    So to get them out of the way:

    If you're leaking memory or spending time managing memory in C++, then you're using C++ wrong. Get a book written in the last 5 years.

    If you're worried about compiler compatibility (with the exception of export which isn't much use anyway), get a compiler written in the last 5 years.

    If you think that C does some subset of your task better, then write it in the common subset of C and C++ and quit whining. Or, write it in C and link it against your C++ code and quit whining.

    If you think that templates simply provide code bloat, then get a compiler newer than 5 years old.

    If you think C++ is slower than C, then get a good optimizing compiler (you know one written in the last 5 years) and do a benchmark. You will generally find that templates make C++ faster.

    If you think "modern" languages are more expressive, then give "modern" C++ a try (insert comment about recent compilers here).

    Sure there are valid complaints about C++, but the majority of them I hear on slashdot are complete bull. The majority of the remaining complaints will be fixed by C++0x.

    One remaining problem is the lack of a vast array of standard, business oriented libraries. I don't write business oriented code, and I find the C++ STL one of the best libraries out there since it provides really good support for writing efficient algorithms.

    Another problem is the difficulty in parsing C++. Sadly that's never going away.

    But if you're going to complain about C++ compared to recent languages here, make sure that you're talking about recent C++ too, and try to make sure the complaints are accurate.

    • by mr_mischief (456295) on Thursday August 21, 2008 @04:51PM (#24695351) Journal

      To be fair, the majority of complaints you hear about most programming languages on Slashdot are complete bull. People complain about the ones they don't like or don't know well enough and praise the ones they do like.

      Once in a while you'll get someone who admits their pet language has faults and warts who explains why they use it anyway. On rare occasions, you might even hear someone say that a language they dislike has their language beat in some way or another. None of these are the rule, though.

      Personally, I think of the C family of languages as an actual family... The patriarch C is somewhat portable macro assembly all grown up with some new tricks his dad never knew. C++ is C's little brother on steroids, complete with the unsightly rippling veins and man boobs. Java is C++ castrated and off the juice. Perl is the awkward bastard child of C and sed with a great skill for vocabulary but a wild of ADHD. C# is Java's soap-opera style evil twin. Objective C is C++'s hot female tree-hugging cousin from northern California who can't quite understand why the family always bickers and can't just get along. D kind of married into the family (probably to Objective C) and brought in a bunch of non-C things back to a style that suits C pretty well, even if he is a young punk. Cmm is the weird survivalist uncle none of C's kids, nieces, and nephews really want to spend time with at the holidays.

      It's a pretty dysfunctional family, but on some level they all belong together. They're not as sophisticated as the Lisp family down the street. They don't coordinate as well as the Concurrents. The Pascal and Modula clan talks a lot more and is stricter with their rules. The C family just keeps getting useful work done, though, and that's why people keep coming back to them.

      My primary language is Perl, but then again I'm an awkward guy with a gift for vocabulary and a wild case of ADHD. At least I know who my father is.

  • by Barnett (550375) on Thursday August 21, 2008 @12:54PM (#24691467) Homepage
    C++ is an extremely powerful programming language and that is why I use it every day. But it has one major problem: It is too complicated. As long as you do programming full time you are OK but if too much of your time is spent on the application side of things you quickly get in trouble. This is what people like BS don't seem to get - not everyone can spend 100% of their time studying the language.
  • auto rocks (Score:5, Interesting)

    by ultrabot (200914) on Thursday August 21, 2008 @12:57PM (#24691515)

    The new "auto" declarations really fix one of the biggest gripes with C++. Everybody is dead tired of doing


    std::map::iterator it = m.begin()

    Now you can just do:

    auto ip = m.begin()

    It takes much of the pain away from static typing...

    • Re: (Score:3, Insightful)

      by jonaskoelker (922170)

      std::map::iterator it = m.begin()

      That'd be "map<signed short int, unsigned long int>::iterator it = m.begin()". And you can write "using namespace std;" instead of "std::", saving a net minus 15 characters ;)

  • by MobyDisk (75490) on Thursday August 21, 2008 @02:09PM (#24692679) Homepage

    C++ was once thought to be a language that was powerful enough that it could be used to express most features that other languages had. With things like operator overloading, multiple inheritance, and templates, you could pretty much make a class behave however you want. But years later, we have seen that C++ failed at that mission. There are simple and common OO constructs that C++ is unable to represent. Rather than focusing on improving the template functionality, I want the OO syntax fixed.

    Let me cite some examples:
    1) It is impossible to make a string class that behaves "normally"

    Plenty of people have tried. QT, Boost, STL, Gnome, WxWidgets, all have their own string classes. Years ago, when VB developers touted how easy it was to use strings compared to C++, I told them it was merely because nobody had made a good string class. After 10 years of trying to write one, and using dozens of other ones people created, I realized that C++ is simply too weak and too loosely typed to do this.

    Suppose I make a string class, kinda like the STL string:
    string foo;
    1) foo = "whatever";
    2) foo = foo + "bar";
    3) foo = 7;
    4) foo = foo + 7;
    5) foo += 7;

    Take a look at these. The first one is no problem. That can call an assignment operator to copy the char * contents to the string. The second one can also be done with a + operator. The third one can also be done via assignment. But what if you forget that? Well, the compiler will see that as foo = foo(7) which will call the constructor that allocates 7 characters, and then assign that. So instead of the string "7" you get a blank string. The next example is a problem too. If the string class can be converted to a const char *, as is common, then does this mean to use the + operator on string and an integer? Or did it mean to convert foo to a const char *, then move 7 characters ahead, then assign it? That can result in a crash. This is because pointer arithmetic is intrinsic in C++, but it is inherently type unsafe.

    Then how about a function that returns a string? A simple case in most languages, but in C++ it results in redundant copies across the stack. So people revert to funny things like auto_ptr and other wrappers, or complex mechanisms for doing shallow copies to prevent that. Other languages just avoid the problem entirely by not allocating things on the callee's stack. It's just an intrinsic problem in the old everything-goes-on-the-stack-by-default mentality of C++. It just doesn't always work.

    Properties are another one. This is something that various libraries try to do, and is free in most new OO languages. But just cant be done in C++ // C#
    class Foo
    {
    private int _x;

    public int x
    {
    get { return _x; }
    set { _x = value; }
    }
    }

    So in the above class, I want to access _x via a property get/set. C# has a built-in construct for this. In C#, I could do:

    MyFoo.x = 7;
    MyFoo.x++;
    MyFoo.x = MyFoo.x + 3;
    MyFoo.x/= 7;

    etc. The compiler knows how to get/set x, and it can even be inlined! This allows me to do things like log when x changes, or see what accesses the variable. Now, let's try that in C++.

    class Foo
    {
    private:
    int _x;

    public:
    int x(); // Get X
    void x(int); // Set X
    int &x2(); // Another way to get/set X
    };

    MyFoo.x(); // Gets x, no problem
    MyFoo.x(7); // Weird syntax, but that is fine
    MyFoo.x()++; // Does not modify the value of x, hmmm...
    MyFoo.x2()++;// Modifies x, but only lets you track the get, not the set.
    MyFoo.x()/=7;// Same exact issue
    MyFoo.x(MyFoo.x()/7); //

    • Re: (Score:3, Interesting)

      by luzr (896024)

      Properties are another one. This is something that various libraries try to do, and is free in most new OO languages. But just cant be done in C++

      I never really understood this effort. What is so good about properties? Why is writing () after getter function name so hard? And for setters, setter chain is much less verbose anyway, like

      mywidget.NoWantFocus().SetReadOnly();

      instead of

      mywidget.nowantfocus = true;

      mywidget.readonly = true;

      Why should any language look like Visual Basic?

    • Re: (Score:3, Informative)

      by noidentity (188756)
      Implicit conversion to const char* is not in the standard string. Neither is a constructor which allows string(n). Your string examples could be supported by a string class, but they would reduce safety by allowing accidental addition to integers. The preferred way is to use a stringstream to convert any object T to a string using its operator . C++0x will address the copying issue via the move constructor, giving user code the benefits without any changes since it mainly concerns library implementors. Rea
    • Re: (Score:3, Informative)

      by Jerry Coffin (824726)

      1) It is impossible to make a string class that behaves "normally"

      Plenty of people have tried. QT, Boost, STL, Gnome, WxWidgets, all have their own string classes. Years ago, when VB developers touted how easy it was to use strings compared to C++, I told them it was merely because nobody had made a good string class. After 10 years of trying to write one, and using dozens of other ones people created, I realized that C++ is simply too weak and too loosely typed to do this.

      The problem isn't that it c

  • by pinkfloydhomer (999075) on Thursday August 21, 2008 @02:57PM (#24693439)

    I also have an extensive experience with C++, and I tend to agree with a lot of the criticism that it gets.

    But the problem is that no alternative exists for the type of problems where C++ is used extensively. I guess the most important area is games.

    The world really NEEDS a language (the last low-level language) with the low-level performance of C++/C and with a full, modern library, and modern language features (threading, modern module system (not based on #includes and a crude preprocessor...), optional strong typing system a la Ada with optional runtime-checking etc etc etc.

    Basically, a really nice, compiled, well-performing, modern low-level language could easily exist. But it doesn't. So we'll have to settle for C++ until someone makes something better.

    • Re: (Score:3, Interesting)

      by phoenix.bam! (642635)

      I guess D is dead? Could have been a lot of hype but it sounded like the language you were looking for.

  • Wait a minute... (Score:3, Informative)

    by Yunzil (181064) on Thursday August 21, 2008 @04:30PM (#24695043) Homepage

    The C syntax is horrendous, the conversion rules chaotic

    Bjarne Stroustrup, creator of C++, is saying that C has a horrendous syntax and chaotic conversion rules...

    ...

    Hahahahahahahahaha.

If you had better tools, you could more effectively demonstrate your total incompetence.

Working...