Slashdot Mirror


Stroustrup Says New C++ Standard Delayed Until 2010 Or Later

wandazulu writes "At the end of an article written by the creator of C++, where he talks about removing a feature from the new C++ standard, he drops a bombshell: The new C++ standard (typically referred to as C++0x) has been delayed until 2010 or later. What does this mean? No new C++ features like threads, proper enum classes, or hash tables. C++0x is dead, long live C++1x!"

113 of 501 comments (clear)

  1. Namespace by Quiet_Desperation · · Score: 4, Funny

    C++0x

    Yes, well, that just rolls off the tongue, doesn't it?

    Maybe he can get one of those hieroglyphs like Prince.

    1. Re:Namespace by Keyper7 · · Score: 4, Insightful

      The Language Formerly Known as C++

    2. Re:Namespace by Zan+Lynx · · Score: 4, Funny

      No. Obviously it is C++0xa.

    3. Re:Namespace by ByOhTek · · Score: 2, Funny

      You forgot C-Pox, what you get, hopefully as a kid and not an adult.

      --
      Self proclaimed typo king, and inventor of the bear destroying coffee table (patent not pending).
    4. Re:Namespace by chivesandbonbon · · Score: 3, Funny

      Looks like a dead fish.

    5. Re:Namespace by vikstar · · Score: 2, Funny

      C++0++x

      --
      The question of whether a computer can think is no more interesting than the question of whether a submarine can swim.
  2. C++0A by gr8_phk · · Score: 4, Funny

    Or C++0x0A no need to change the name.

    1. Re:C++0A by joss · · Score: 3, Funny

      Actually, that's what they're doing, its not a joke [my money's on C++0b though]

      --
      http://rareformnewmedia.com/
    2. Re:C++0A by Eddy+Luten · · Score: 3, Informative

      Cocoa is an API, Objective-C is the language.

    3. Re:C++0A by Unoriginal_Nickname · · Score: 2, Funny

      God only knows.

      My money's on C++xx

    4. Re:C++0A by Elektroschock · · Score: 2, Informative

      Oh, and there is gnustep.

    5. Re:C++0A by Wildclaw · · Score: 4, Funny

      My big question.

      The original demonic summoning of the C++ spec was done using a piece of the tower of babel, a succubus and 2 top laywers arguing over who shouldn't be sacrificed. What ingredients were they using this time, and why did it fail?

  3. Well, it could... by Petersko · · Score: 5, Funny

    "C++0x... Yes, well, that just rolls off the tongue, doesn't it?"

    Well, it does if you just pronounce it "Cocks".

    1. Re:Well, it could... by Bemopolis · · Score: 5, Funny

      If the cock rolls off your tongue you're doing it wrong.

      --
      "I guess the moral of the story is, don't paint your airship with rocket fuel." -- Addison Bain
    2. Re:Well, it could... by Darinbob · · Score: 2, Funny

      No, the pluses are pronounced "up". As in "cocks up".

  4. Re:How about a REAL C++ feature.... by EkriirkE · · Score: 2, Insightful

    Because this is obviously the language's fault.

    --
    from 09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0
    to 45 2F 6E 40 3C DF 10 71 4E 41 DF AA 25 7D 31 3F
  5. Not a bombshell by shutdown+-p+now · · Score: 4, Informative

    It's not a bombshell by a long measure. Anyone who had been tracking C++0x standardization process (reading comp.std.c++, and WG papers) knows that the goal of getting the standard out by 2010 was fairly unrealistic, mostly because of concepts. The joke that "x" in C++0x is actually a hex digit and not decimal has been around for several years now.

  6. in related news... by cowdung · · Score: 5, Funny

    The latest version of Cobol (eagerly expected by 6 people) will also be delayed till January 2011.

    1. Re:in related news... by oldhack · · Score: 2, Funny

      God damn it!

      --
      Fuck systemd. Fuck Redhat. Fuck Soylent, too. Wait, scratch the last one.
    2. Re:in related news... by clintp · · Score: 4, Funny

      No worries. C++1x will still be out before Perl 6.

      --
      Get off my lawn.
  7. Re:How about a REAL C++ feature.... by ardor · · Score: 5, Insightful

    Or a crowbar for anybody who thinks languages make things automatically safe.

    If you are a good programmer, you can do safe programs in C++ or any other language.
    If you are a bad programmer, you can't do that in C++ or any other language.

    --
    This sig does not contain any SCO code.
  8. Headline misses the point completely by Anonymous Coward · · Score: 5, Informative

    The headline completely misses the central part of the article and focuses on a very minor point. Everyone has known for quite a while that C++0x would actually be C++1x. There's only a few months left in 2009, so there's absolutely no surprise there. The real meat of the article is that support for "concepts", a key (and arguably the most anticipated) part of C++0x, is being dropped. That's a major disappointment to many people, including Stroustrup.

    1. Re:Headline misses the point completely by ardor · · Score: 4, Insightful

      Yeah, but it is reasonable. Concepts are a complex feature, and C++ is an (overly) complex language. Do you really want to hold back all the other very important features like lambda, rvalue references, variadic templates, type deduction etc. just because of concepts?

      --
      This sig does not contain any SCO code.
    2. Re:Headline misses the point completely by jpmorgan · · Score: 3, Insightful

      Absolutely. C++ is a very complex language, and concepts were a feature that was going to be critical in reducing that complexity.

    3. Re:Headline misses the point completely by jpmorgan · · Score: 2, Insightful

      No, concepts weren't for the developers of big template libraries, it was for the users. There are large portions of boost which are powerful and useless to your average programmer, because simple mistakes lead to impenetrable error messages.

  9. Buffer overflow by tomasd · · Score: 2, Funny

    There will be buffer overflow after C++0xFF

    1. Re:Buffer overflow by Procasinator · · Score: 3, Informative

      There will be integer overflow after C++0xFF

      Fixed that for you.

  10. Re:And nothing of value was lost by ardor · · Score: 3, Informative

    Are you saying that C++0x is unnecessary?

    If so, then you haven't stumbled upon C++'s many problems. Like, lack of rvalue references. Or, lack of a proper lambda.

    --
    This sig does not contain any SCO code.
  11. Re:How about a REAL C++ feature.... by HonIsCool · · Score: 5, Insightful

    With that definition of good programmer, are there in fact any good programmers?

    --
    "Give me six lines of C++ code written by the most competent programmer, and I will find enough in there to hang him."
  12. Re:How about a REAL C++ feature.... by PylonHead · · Score: 5, Insightful

    If you are a good programmer, you can do safe programs in C++ or any other language.

    So it must just be that there are no good programmers. Because I haven't seen any safe web browsers, word processors, or PDF readers.

    --
    # (/.);;
    - : float -> float -> float =
  13. Re:How about a REAL C++ feature.... by Anonymous Coward · · Score: 2, Informative

    sure when those 'memory safe' languages produce efficient executables that do not require 400MB 'runtimes' to function. The net result from these sandbox environments is a bloated app that requires 5-10x more ram than is needed.

  14. Oh, please. by jcr · · Score: 5, Insightful

    No new C++ features like threads, proper enum classes, or hash tables

    Cause one thing C++ sure doesn't have is enough features, right?

    -jcr

    --
    The only title of honor that a tyrant can grant is "Enemy of the State."
    1. Re:Oh, please. by RiotingPacifist · · Score: 2, Insightful

      don't like new features, DONT USE THEM, this is one of the few cases where teh new version will not degrade in performance if you ignore the new features!

      --
      IranAir Flight 655 never forget!
  15. Re:How about a REAL C++ feature.... by ardor · · Score: 2, Insightful

    "Can" does not imply "must".

    --
    This sig does not contain any SCO code.
  16. Re:How about a REAL C++ feature.... by AuMatar · · Score: 2, Insightful

    Or better yet- take the crowbar and whack programmers who can't write in C++ until they leave the industry. If you can't understand memory allocation and pointers, you aren't competent to be in this profession.

    --
    I still have more fans than freaks. WTF is wrong with you people?
  17. Re:How about a REAL C++ feature.... by Anonymous Coward · · Score: 3, Funny

    Someone give grandpa his oatmeal.

  18. C++0x is really good though by MobyDisk · · Score: 4, Informative

    I haven't been following C++0x, but after reading the C++0x FAQ I am very pleased. It really fills a lot of the simple, practical holes in the language.

    I think the success of C# is part of why these things are being considered. For example, C# recently added an advanced form of initializer lists - which is now in C++0x. Another example is the scoping of enums, which has long been a pain. Many coding standards require enums to be ALL_CAPS_WITH_UNDER_SCORES because they don't obey scoping rules: this is fixed. NULL is now replaced with nullptr, which is a minor improvement that looks much like how this was done in C++/CLI. (That's the bastardized C++ for .NET). Namespace cleanups, foreach, ... the list is huge, and it looks like C++ is "borrowing back" from Java and C#.

    Competition is good.

    I know that everything I just listed probably exists in many other languages, but C# and Java are very prominent in enterprise development, and are making huge gains. I will be very very glad to see a real ISO standard gaining ground again.

    1. Re:C++0x is really good though by StormReaver · · Score: 4, Insightful

      but C# and Java are very prominent in enterprise development, and are making huge gains.

      When discussing languages with coworkers, I've frequently opined that C# is the best thing to have happened to Java in many years. Java had stagnated for a long time without any competitive threat to its domain, which eventually caused me to stop developing in it entirely and focus on C++/Qt.

      A couple years ago, I looked into it again out of curiosity, and saw how far it had come since the introduction of a credible competitor (C#). Swing (it's GUI system, for those who aren't familiar with it) had gotten fast, printing turned from a lame dog into a sports car, and the core language had gained features it lacked until they appeared in C#.

      As much as I despise Microsoft, the competition has been fantastic for Java.

    2. Re:C++0x is really good though by jez9999 · · Score: 2, Insightful

      I'd still lurrrrve to see properties in Java.

    3. Re:C++0x is really good though by Bluesman · · Score: 2, Insightful

      I read the FAQ and I can't shake the feeling that C++0x is a joke that someone's taken way too far.

      It's kind of like how I believe pop icons like Britney Spears are famous because of music industry execs betting they can make anybody famous and then trying to one-up each other when it works.

      Anyway, my favorite part:

      "Try to imagine what the superset of C99, C#, Java, Haskell, Lisp, Python, and Ada would look like."

      I imagine it would look very similar to Common Lisp.

      --
      If moderation could change anything, it would be illegal.
    4. Re:C++0x is really good though by shutdown+-p+now · · Score: 3, Informative

      A couple years ago, I looked into it again out of curiosity, and saw how far it had come since the introduction of a credible competitor (C#). Swing (it's GUI system, for those who aren't familiar with it) had gotten fast, printing turned from a lame dog into a sports car, and the core language had gained features it lacked until they appeared in C#.

      Unfortunately, it's still lagging behind. Java may have gotten autoboxing, enums and varargs because C# had them, but in the meantime C# got lambdas (which are arguably far more important in the big scheme of things, and definitely have a bigger impact on how one writes code). And lately, Java language evolution looks like it has stagnated.

      Of course, there's Scala to consider. If only someone with deep pockets would back it...

  19. Re:How about a REAL C++ feature.... by geekgirlandrea · · Score: 2, Insightful

    This. Can we add a special addendum specifying the use of chainsaw instead of a crowbar for fixed-size buffers without checking for overflow?

  20. Thats a mouthful by Demonantis · · Score: 4, Funny

    C++0x is a goofy name no wonder no one wants to work hard on it. How would you like that on your resume. C+=2 is much more consistent with the language and is much easier to read.

  21. Re:How about a REAL C++ feature.... by Rei · · Score: 2, Interesting

    Forget about type safety... just give me the "auto" variable type. :P

    --
    Dear Lord: One of your creatures may be hurt tonight. Please let it be the other creature.
  22. who cares? by speedtux · · Score: 4, Insightful

    C++ has reached staggering complexity already; I don't think adding another 40 pages of complicated features is going to make the language any better.

  23. Re:How about a REAL C++ feature.... by Anonymous Coward · · Score: 2, Informative

    someone stop feeding this kiddie count chocula and remind him that his precious sandboxed languages waste cpu cycles...lots of them, and that trend is increasing. The unchecked bloat that is being output by these latest college grads who know nothing but c#, vb, and java are serving no one's interest besides the hardware vendors.

  24. So in reality we shouldn't use it until 2015 then by SpyPlane · · Score: 5, Insightful

    I've been following C++0x for a long time now, and have been looking forward to it, but now I'm not so sure I'll ever use it. I was looking forward to Concepts more than anything and with that gone, it seems like a extremely minor upgrade. Also, even when the spec does come out, how many years before we can trust that most compilers can use it effectively... two, three? Then after we've been using it for a while, how long before books come out that tell us that we've been using it all wrong and we have to start over (ie: the Exceptional " " and Effective " " books from Sutter and Meyers)?

    Okay, so I can use C++0x well in 10 years, okay I'll probably be so burned out by then I'll be a manager, or I will have convinced someone to let us use D for embedded work and something managed for everything else.

    --
    "We need a fourth law of Robotics: Stop Fingering My Wife"
  25. Re:How about a REAL C++ feature.... by Freetardo+Jones · · Score: 5, Insightful

    Or better yet- take the crowbar and whack programmers who can't write in C++ until they leave the industry.

    Because C++ is the pinnacle of programming knowledge? *giggle*

    If you can't understand memory allocation and pointers, you aren't competent to be in this profession.

    Just because one can understand memory allocations and pointers doesn't mean one wants to have to deal with them manually in all their programs. There is a reason why there are auto_ptrs in C++ and it's not because those people are "noobs", it's because people want to actually spend their time writing the program rather than having their time eaten up by writing tons of boilerplate memory management code.

  26. Re:And nothing of value was lost by speedtux · · Score: 2, Insightful

    If so, then you haven't stumbled upon C++'s many problems. Like, lack of rvalue references. Or, lack of a proper lambda.

    I think \bigger problems are C++'s complexity, the presence of pointers, the use of include files, and the lack of garbage collection.

  27. Mod parent up... by argent · · Score: 3, Funny

    On the whole, I'd rather code in Ratfor.

  28. But will they be useful without concepts? by wowbagger · · Score: 4, Interesting

    "Do you really want to hold back all the other very important features like lambda, rvalue references, variadic templates, type deduction etc. just because of concepts?"

    Unfortunately, without concepts, many of the templates that would make features like those REALLY powerful aren't implementable due to silly things like the compiler insisting upon being able to instantiate member functions that don't make sense for a class and won't be used, just because there isn't a means to tell the compiler "and if this member doesn't make sense, just don't instantiate it, and throw an error IF AND ONLY IF somebody tries to use it." (and yes, I know about SFINAE, but that gets REALLY UGLY to do).

    I've been bit by this, where I ended up having to create two completely separate template classes, one for objects that don't have sub-members and one for objects that do, just because I couldn't tell the compiler "Look, if operator . doesn't exist for this method, then don't worry about it!"

    That said: I will say, I felt that some of the implementation details of concepts felt "forced" to me, in the same way that the streams library feels "forced": they "hacked" (in the bad way) the library in using language semantics that weren't a good fit.

    <sigh/> - I hope the extra time will allow them to put a bit more polish on how you actually express things, and make it feel less "forced"....

    1. Re:But will they be useful without concepts? by Henry+V+.009 · · Score: 2, Insightful

      Stroustrup alludes to it in his article, but I think that the point needs to be emphasized. Concepts need to primarily be about making the experience of using and creating templates easier. It needs to be about fixing the sort of error you mentioned.

      The problem with the current proposal is that it tried to be too many things to too many people. Concept supporters need to regroup and come up with a streamlined concepts proposal that concentrates on making the language easier and simpler.

    2. Re:But will they be useful without concepts? by Zeinfeld · · Score: 3, Interesting
      I remember C++ from way back when it really was C-with-classes. Plus some operators. (I think the rot set in with operators.) Back then, one person (who already knew C) really could grok the language in a day or two.

      Oh I remember those days. Less good than you imagine. The language might have been simple but the compilers were a complete bitch. Some of them were not even compilers, they were preprocessors.

      They would throw up the type of errors that Visual Studio did when I tried to compile Google Chrome when it came out, 'Type *QWUejw::int(*float) is not equal to *QWUejw::int(*float)'. So instead of taking a week to write your code you could spend three days coding and a month debugging the compiler.

      Thats the real reason everyone jumped onto Java. It was clear that C++ was the product of very confused minds but it was the successor chosen by AT&T labs themselves, it was odds on to win. The only other player in the game was Objective C which was being touted by Steve Jobs, but you had to have a $!0,000 NextStation game cube to run it on. Eifel was maybe interesting but looked highly unlikely to win.

      --
      Looking for an Information Security student project suggestion?
      Try http://dotcrimeManifesto.com/
  29. Forty acres and a flying car... by argent · · Score: 5, Insightful

    C++ can't be fixed by adding features.

    C++ can only be fixed by removing features.

    My minivan won't get me to Jamaica, so I need to add wings or pontoons? Or maybe I should buy an airline ticket instead?

    Use the right tool for the job. Sticking another bag on the side of a language that's almost entirely bags isn't going to fix it. If you need a better language than C++, maybe you shouldn't be using C++.

  30. Ye canno' change the laws of physics... by frank_adrian314159 · · Score: 3, Funny

    They can't release a new standard until they figure out a way to keep the language from collapsing under its own weight, forming a black hole that would destroy the solar system.

    --
    That is all.
  31. Re:How about a REAL C++ feature.... by Freetardo+Jones · · Score: 2, Informative

    First: OO.o is Java.

    Bzzzt wrong. Look at the code, it's 98% or so C++. The only parts that are Java are some database access layers and some stuff for multimedia. Way to show yourself as being an idiot for repeating this oft-repeated and incorrect meme.

    Second: The language has little to no bearing on the amount of RAM being used. The amount of data being stored (and how it's stored), however, does. Firefox stores a lot of images and such, which, surprise surprise, eat up RAM.

    So then you've just effectively nullified your own point since you were blaming the languages on the bloat instead of the crappy programmers.

  32. Re:Who cares now? by Tanktalus · · Score: 5, Funny

    There are two basic problems with your code. First, there are unbalanced parenthesis. Second, this is a thread about C++. Not Perl. Next time, be more careful. Thanks.

  33. Template la-la land. by Animats · · Score: 5, Insightful

    Some years ago, the C++ committee went off into template la-la land. Most of the work there focuses on template features that will be used by few, and used correctly by fewer.

    Templates are useful, but "generic programming", doing arbitrary computation at compile time with templates, was a terrible idea. Templates can be abused as a recursive term-rewriting system, and through some clever and obscure tricks, recursive computations can be run at compile time. As a programming language, this trick is awful; awful from a syntax point of view, awful from an understandability point of view, and awful from a debugging point of view. If you need to do work at compile time, there have been much better approaches. LISP "macros" were standard LISP, not a second language. And even they created such a mess that Scheme had to be invented to clean out the language.

    Orignally, templates were conceived as a saner way to do what C programmers did with macros, providing a way to have some type independence at compile time. But the template crowd got out of control.

    The obsession with templates has led to a neglect of things C++ really needed, like better memory safety (C++ still has buffer overflows, and most of the security holes today stem from this), and better approaches to concurrency (the compiler has no idea what locks what, and it needs to know). Anything that wasn't template-related tended to be ignored by the committee.

    The result of this failure has been C++ spinoffs - Java, C#, etc. Even Objective C has made a comeback in the Apple world. C++ has never even been able to displace C, twenty years on.

    I've written a lot of C++, and I'm disgusted with this mess.

    1. Re:Template la-la land. by alphabetsoup · · Score: 3, Interesting

      Templates are what makes programming in C++ a joy compared to other languages. And concepts would have completed the generic programming framework in C++. Concepts are like typechecking for templates. With templates + concepts, programming in C++ would have been almost as elegant as Haskell, except 10 times faster.

      Without generic programming you not have typesafe containers, no smart pointers, no typesafe variadic functions. In fact templates have almost replaced OOP in C++ - libraries like ATL use templates for compile time polymorphism, instead of runtime polymorphism using virtual functions.

      I suggest you read Alexandrescu's Modern C++ Desing before commenting on generic programming. Modern C++ is not the C++ of 1990s.

    2. Re:Template la-la land. by Xtravar · · Score: 5, Insightful

      You mean C++ being a clusterfuck of ugly syntax isn't a reason for using C?

      I learned C++ first. I thought the 'limitations' of C were silly and archaic. Then I grew up and realized that having straight-forward, easy-to-maintain code is much more important. /feeding the troll

      --
      Buckle your ROFL belt, we're in for some LOLs.
    3. Re:Template la-la land. by maxwell+demon · · Score: 2, Informative

      Templates are useful, but "generic programming", doing arbitrary computation at compile time with templates, was a terrible idea.

      Doing arbitrary computation at compile time with templates is called "template metaprogramming." The "generic programming" is what the STL does: Provide a single templated implementation for an algorithm working out of the box on vastly different data structures.

      --
      The Tao of math: The numbers you can count are not the real numbers.
    4. Re:Template la-la land. by istartedi · · Score: 4, Insightful

      Ditto here. When I got my first "modern" PC, a Pentium 75 I wanted to learn how to program on it and got Microsoft's compiler. The books that came with it actually did a pretty good job of teaching C++. I wrote a fairly large program in C++--A program for editing VRML. I had to link in libraries for JPEG and PNG. When I saw how elegant and cross-platform these libraries were, I realized what a mess C++ was. I also realized how Object-Oriented Programming tended to paint people into a corner. I ended up having to instantiate Foo in order to access function Bar, when I should have simply written all the functions as stand-alone functions, using only the structures they needed.

      By the time I was done messing around with VRML (which does in fact model well as a class hierarchy) I had come to the conclusion that maybe 10% of the problems out there require an OOP language.

      Now I tend to think it's an even lower number, and I would just as soon work around it when necessary by rolling my own objects in C (function pointers, yay!).

      I wrote more and more C. I haven't written C++ for myself, or professionally, in 10 years.

      I know this is controversial; but I think OOP has polluted and hopelessly corrupted the minds of an entire generation of programmers. I find myself taking an interest in FORTH lately, and to a lesser extent, Lisp.

      --
      For all intensive purposes, "whom" is no longer a word. That begs the question, "who cares"?
    5. Re:Template la-la land. by thechao · · Score: 2, Insightful

      Okay, IAAEOC++0x (I am an expert on C++0x), one of my group's PIs is Bjarne Stroustrup and my committee consists of members from both the Indiana & Texas concepts proposal; the extended group is responsible for lambdas, concepts, variadics, for-each constructs, etc. Credentials aside, "templates" != "generic programming". Concepts were designed to provide a predicative type-system for templates [think of this as a kind-system] which allows us to get rid of most of the template metaprogramming hacks (SFINAE enable-if/disable-if, type computations, etc.). Variadics (also for templates) get rid of list-like type-computations. At the cost of adding a relatively light-weight description of an interface (think of a concept as a compile-time only interface) we can get rid of almost all of the hairy bits of template coding.

      The reason why concepts was rejected is due to some of the uglier corner cases stemming from a requirement for soundness in the type-system using concepts. As we are slowly approximating second-order types with C++ (all typeful languages end up doing this to increase expressivity) there are bound to be some hiccoughs. What happened at ISO (as far as I know) came from an argument on the reflector which revolved around the default of whether a concept was auto(matically) satisfied by a type or if it must be explicit [a fairly arcane argument], in addition to the handling of associated and intermediate generated types. It is not clear if a simpler solution can be constructed for a decidable type-system.

  34. Re:And nothing of value was lost by shutdown+-p+now · · Score: 4, Insightful

    There is nothing they can add to any language that cannot be done effectively with C and C++ with a good support library like BOOST and STL.

    The whole point of concepts was to make C++ libraries that heavily rely on templates, such as STL and Boost, easier to use. As it is, C++ templates are effectively compile-time duck typing, which means that error is reported not at point of call, but where it actually leads to non-compilable code produced during template instantiation (which is usually inside the library you're calling). Ever made a mistake while calling boost::bind (or, Heaven forbid, while using Boost lambdas)? Do you remember what the error message looks like when it happens?

  35. Re:How about a REAL C++ feature.... by PitaBred · · Score: 3, Interesting

    And there are times when you want the memory management code for performance, and you can't get to it. I've seen such horrible Java programs from new programmers because they are never taught ANYTHING about memory management. You can't forget about memory in ANY language that you use. I highly value C/C++ as an initial learning language because it forces you to recognize that resources need to be allocated in order to use them. Java and other languages make implicit allocation easy, but it hides that from the programmer, which allows people to shit all over memory because they don't have a clue about removing objects when done, or even just removing all references to them. They just don't know.

  36. Re:And nothing of value was lost by Tacvek · · Score: 2, Informative

    C++0x is just an evolution of C++. It does not add anything that is not already possible, but it does attempt to improve certain usecases. Adding threading support to the language core allows the standard library to be used with threading, and makes it easier to write thread-safe code. (As it is, you need to look up for each and every compiler/standard library pair you use which if any standard library functions are threadsafe.)

    The hash-based containers have been fairly standard since the beginning, although there were slight incompatible differences between the implementations, which meant that portibility suffered if you used them. Now adopted by the Standard Library, you can use them in any C++ implementation that support C++0x (Which will be most of them. Even Microsoft plans to strive for a fully complaint implementation, minus a small number of legacy deviations (although they will always remain fairly far from perfect compliance)).

    Much of the standardization effort is in bringing chunks of BOOST into the standard library, such that you can just use them without installing all of BOOST (which is pretty extensive). They are adding a few nice convenience features, such as lambdas (really useful with STL algorithms), and a few other features.

    Just like any decent C compiler supports C99, all good C++ compilers will support C++0x. It is highly backwards compatible, although a few minor breakages will be present, especially if you use one of the few new keywords as an identifier.

    --
    Stylish sheet to fix many problems in Slashdot's D3: https://gist.github.com/801524
  37. Re:So in reality we shouldn't use it until 2015 th by shutdown+-p+now · · Score: 4, Interesting

    I've been following C++0x for a long time now, and have been looking forward to it, but now I'm not so sure I'll ever use it. I was looking forward to Concepts more than anything and with that gone, it seems like a extremely minor upgrade.

    I would disagree on this part. I'm already using some C++0x features actively in production code, and I can say that they are well worth it. Lambdas are extremely handy as they finally let you use STL (and Boost) algorithms properly without lots of unneeded hand-waving. This may sound a minor thing, but remember how things have changed in C# world when anonymous delegates were introduced in C# 2.0, and their syntax simplified in 3.0? All of a sudden, everyone shifted to functional ("LINQ") techniques of writing code, abandoning hand-coded loops. The same thing happens here.

    The second big part is rvalue references. They really do give major performance benefits for STL containers, especially of user-defined types (as smart implementations of C++03 already optimize their containers for standard types to avoid copy by using swap instead - but they can only legally do it for types they control...).

    One other thing. C++0x may take a while to be released, but you'll see quite a few of its features in production-quality compilers before the spec is finalized. I've already pointed out that some are in VC++2010. There's even more in newer g++ versions (IIRC, they implement all that stuff, and also variadic templates). I've also seen mention of rvalue references and lambdas in the feature list of the most recent C++Builder release. All in all, this means that you'll have them at your disposal within a year or so one way or another.

  38. Re:How about a REAL C++ feature.... by PylonHead · · Score: 2, Interesting
    --
    # (/.);;
    - : float -> float -> float =
  39. Re:How about a REAL C++ feature.... by CastrTroy · · Score: 3, Informative

    Azureus isn't a browser though. It downloads torrents. They do completely different things. A browser actually has to render images, animations, and even videos. It has to parse large amounts of HTML, CSS, Javascript, and make sense of all that so that it can display it on the screen. Torrent applications are basically glorified FTP clients. They don't have to display anything on the screen at all. They just have to manage a bunch of internet connections and save some data to the disk. It's like me saying that Notepad uses less memory than Azureus, therefore C++ is better. Show me a browser with a similar feature set to Firefox written in Java, and then we can talk.

    --

    Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
  40. Re:How about a REAL C++ feature.... by Joce640k · · Score: 5, Insightful

    The problem is the amount of C programmers/thinkers who think they're writing C++ just because they type "class". It doesn't work that way, C++ is a totally different language.

     

    eg. If you're Doing It Right then it's impossible to get a "buffer overflow" in C++. Most of the exploits you see are down to buffer overflows so I leave you to draw your own conclusions about the programmers.

     

    Problems with C++ that will catch C programmers:

    • Lack of a standardized smart pointer. That would have made a huge difference.
    • Arrays. Arrays are evil. C++ should have skipped arrays and gone directly to std::vector.
    --
    No sig today...
  41. Re:How about a REAL C++ feature.... by PylonHead · · Score: 2, Interesting

    So, if I'm understanding your argument, there are good programmers, but none of them are actually trying to program securely.

    They could stop writing vulnerabilities if they wanted to...

    --
    # (/.);;
    - : float -> float -> float =
  42. Re:How about a REAL C++ feature.... by johnlcallaway · · Score: 3, Informative

    Gotta have the "auto" variable because expecting all programmers to know how to type efficiently or to understand what data types are being used isn't fair to those that haven't gained those skills yet.

    --
    I rarely read replies, it's my opinion and if you thought about your opinion a little more, I'm OK with that.
  43. Re:Why this is bad by oldhack · · Score: 2, Funny

    C++:
    You can program it like assembly.
    You can program it like FP.

    They should bring Larry Wall into the committee and things will really get cooking. Imagine the awesome possibilities.

    --
    Fuck systemd. Fuck Redhat. Fuck Soylent, too. Wait, scratch the last one.
  44. Re:How about a REAL C++ feature.... by Joce640k · · Score: 4, Interesting

    That's funny cause I've never seen a single C# or Java app.

     

    Where are they? If C# and Java are so great, where are the apps? It's been, what, twelve years since it was announced that they'd take over the world and make C and C++ obsolete but I've yet to see a C# or Java program that wasn't some simple sort of utility or the GUI layer over a C++ app (eg Norton products).

     

    What I have noticed is that all those "GUI layer over a C++ app" programs are enormous. 200Mb for a disk backup program (both Norton Ghost and Acronis TrueImage went from 20Mb to 300Mb during their transition-from-C phase and neither of them seems any better off for it.

     

    Firefox memory usage is a mystery to me. I can't conceive of how it uses so much memory just to show a few pages of text with embedded images. The other browsers aren't really far behind though so maybe I'm missing something.

    --
    No sig today...
  45. Re:How about a REAL C++ feature.... by DuckDodgers · · Score: 3, Interesting

    Care to hazard a guess as to how complex those 5 .NET and Java applications are compared to a web-browser or Office Suite?

    To make the comparison fair, you should be measuring Firefox against a more or less even-featured competing web browser written entirely in .NET or Java, running the same websites. Likewise for comparing against OpenOffice. I don't think either item exists yet.

    I'm not saying Firefox and OpenOffice are especially lean applications. They definitely do seem like resource hogs. But the most logical explanation for the lack of proprietary or open source Java and .NET web browsers and office suites to compete with them is that they flat out can't do it.

  46. Re:And nothing of value was lost by Joce640k · · Score: 2, Insightful

    Funnily enough, all the features you mention are ones which CAN be fixed with "a good support library".

     

    (Apart from the include files...)

    --
    No sig today...
  47. Re:How about a REAL C++ feature.... by Tarlus · · Score: 3, Interesting

    Just because one can understand memory allocations and pointers doesn't mean one wants to have to deal with them manually in all their programs.

    I fully agree with this. I've learned all about the use and necessity of pointers and allocation, and I've done my time with the debugging and memory leaks because I didn't do it right. Lots of great lessons from that. And I can really appreciate languages that handle that for me so I don't have to fuck with it. It saves me so much time and frustration.

    Although it irks me that colleges start people off with these languages now. Most students I teach were brought up on a strict diet of Java and so to them, variable declaration is just a formality and pointers (or references, as the Java people insist) are just part of the magic that happens behind that friendly, colorful compiler.

    These are the types I fear for in the industry.

    --
    /* No Comment */
  48. Re:Why this is bad by shutdown+-p+now · · Score: 2, Informative

    I would describe concepts as increasing the usability of templates because you start to get readable error messages, but I don't see anything that can be done with concepts that can't be done without.

    Concepts let you "overload" templates depending on whether a template parameter conforms to some concept or not. You can do some of that right now with SFINAE, but it's a hack of epic proportions, and it doesn't cover all use cases (e.g. it doesn't let you test for members).

  49. Re:And nothing of value was lost by Stele · · Score: 5, Interesting

    I think bigger problems are C++'s complexity, the presence of pointers, the use of include files, and the lack of garbage collection.

    Funny - I see all of those things as advantages.

  50. Re:How about a REAL C++ feature.... by Anonymous Coward · · Score: 3, Interesting

    If C++ wasn't based on C, it might have been a decent language...
    OOP, metaprogramming, RAII, exceptions are all decent concepts. Too bad it also inherited C's "arrays are just pointers" idiom, and extended C's already stupid grammar to the point of grotesqueness. And it's not going in the right direction nowadays either. The syntax they chose for lambdas in C++0x is awful.

  51. Any topic by BigJClark · · Score: 3, Insightful


    Any topic that involves geeks and C++ is just asking for flame wars, I'll submit my name to the mix.

    Although I've been coding in c++ for more years than half of you have been alive, and am rather biased, I feel good programmers write good code independent of the language they use.

    --

    Hi, I Boris. Hear fix bear, yes?
  52. Re:How about a REAL C++ feature.... by geniusj · · Score: 4, Informative

    Any garbage collected language requires more memory to operate than the program actually needs.. Otherwise you'd be garbage collecting 24/7. So yes, if you want to minimize GC cycles/pauses, your memory usage can be vastly higher than what the program would actually require in a traditional language. That's probably the big reason, for example, that the iPhone doesn't support GC in its Objective-C implementation.

  53. Re:How about a REAL C++ feature.... by Joce640k · · Score: 2, Informative

    Um, yes. And they do.

     

    Take a look at something like Acronis TrueImage (or any Norton program) before/after their transition from C++ to C++-with-C#-user-interface.

    Installer before: 29Mb

    Installer after: 290Mb

    Memory usage: Completely unusable on a 512Mb machine

     

    nb. I use these as an example because they're the only commercial apps I can think of that use .Net.

    --
    No sig today...
  54. Re:How about a REAL C++ feature.... by squoozer · · Score: 5, Interesting

    Back in the day they used to have little children crawling around under cotton stipping machines. The children were needed to pick up fluff and other debris that would cause the machine to break the thread it was working on. Some children would get crushed in the machine because they weren't fast enough to get out of the way etc.

    C++ is a bit like that machine. It works fine if you have the luxury of being able to pick only the fastest most able children but there comes a time when you need to grow your business beyond the limits of what the best can achieve. At that point you need to either accept that some of the less able children will get crushed (bugs in the code) or you need to make the machine safer. It's often cheaper and simpler to make the machine safer and hopefully those most able children will then be able to perform more complex and hopefully profitable work.

    To paraphrase... everytime you argue for a language without safety features god kills a child.

    --
    I used to have a better sig but it broke.
  55. Re:How about a REAL C++ feature.... by NoOneInParticular · · Score: 2, Insightful

    How many Java browsers are out there? None? Case in point.

  56. What's with the back(s)lash? by jonaskoelker · · Score: 2, Funny

    Or, lack of a proper lambda.

    I think \bigger problems

    Is that backslash some kind of Haskell joke?

  57. Re:How about a REAL C++ feature.... by Freetardo+Jones · · Score: 2

    No, he was saying that if you weren't a C++ programmer that you should leave the industry as if being able to program C++ and knowing pointers and memory management was some sort of godlike skill. The people who bluster on about how they know about memory management and pointers are usually the ones who write some of the leakiest code around.

  58. Re:How about a REAL C++ feature.... by dgatwood · · Score: 2, Informative

    It's not necessary to check a return value if you don't care if the action succeeded or failed. One could reasonably argue that (at least in GUI application) printf qualifies as just such a throwaway statement.

    As for returning an exit status, AFAIK, both C99 and C++ codify that a main() function should implicitly return zero if the end of the function is reached. Thus, that's also correct, although one could argue that the behavior was OS-dependent back when that code was originally written, and thus it has only become correct in the past decade or so. :-)

    --

    Check out my sci-fi/humor trilogy at PatriotsBooks.

  59. Re:How about a REAL C++ feature.... by farnsworth · · Score: 2, Informative

    Where are they? If C# and Java are so great, where are the apps?

    gmail, amazon, your online banking, etc.

    Firefox memory usage is a mystery to me. I can't conceive of how it uses so much memory just to show a few pages of text with embedded images.

    Modern web standards are extraordinarily complicated. The current html spec is 756.93 KB alone. Add to that css, js, xml, http, etc. Add to that compatibility with the millions of existing web pages, and all of a sudden you have a ton of complicated code in order to display "a few pages of text".

    --

    There aint no pancake so thin it doesn't have two sides.

  60. Re:How about a REAL C++ feature.... by QRDeNameland · · Score: 3, Insightful

    And btw before someone mentions something like Azureus as a counterexample, I've seen Firefox still eat up more RAM than that program if they are running for the same period of time and that's with about 10 or so torrents running in it.

    And just as pointlessly, I've seen Photoshop eat up far more memory than my Java "Hello World" program. Seriously, pitting a modern web browser to a BitTorrent client to compare the languages used to code them is beyond absurd.

    As someone else noted below, compare Azureus's memory footprint (as well as speed and responsiveness) to uTorrent, which has virtually identical functionality to Azureus but is written in C++.

    --
    Momentarily, the need for the construction of new light will no longer exist.
  61. Re:How about a REAL C++ feature.... by petermgreen · · Score: 2, Interesting

    Like the guy who wrote Hello, World. Completely safe.
    It is because of both it's triviality and the fact it doesn't deal with untrusted data (or any data).

    Real systems are a lot more complex and they often have to deal untrusted data. Noone is perfect and it is almost a certainty that a coder will overlook something or make an incorrect assumption sooner or later. Of course some coders will do it more often than others. If they are lucky they spot it during testing and/or it is not exploitable. If they are unluky they have just introduced a security hole.

    You can reduce the bug rate in code by hiring better programmers or by doing a lot more testing and inspection of code, but you quickly get into very high costs and diminishing returns and some bugs still slip through (see: NASA).

    C (and some C++ subsets*) has very little checking built into the language. As a result of this it is easy to end up with bugs that allow overwriting memory the code was never meant to even touch and thus allowing injection of code.

    *C++ is a huge language (it's not quite a strict superset of C but it's pretty close) with an even bigger standard library. Some constructs in it are much safer than others and so it's vulnerability depends on what subset you work with.

    --
    note: i'm known as plugwash most places but i screwd up registering that here somehow in the past and now can't register
  62. Re:How about a REAL C++ feature.... by Joce640k · · Score: 2, Insightful

    "Could that be because Bjarne first named it "C with classes"?"

    It's because writing good C++ requires a lot of patience and self-discipline, something that most "programmers" simply don't have (or they're always up against a deadline or some other excuse for "just get it working, we can tidy it up later",- which never happens and you go into a downward spiral).

    --
    No sig today...
  63. Syntactic sugar, no more. by loufoque · · Score: 3, Informative

    C++0x adds syntactic sugar, no more.
    I'm actually relieved to see concepts dropped, that was probably the biggest useless sugar ever (axioms were not just sugar, but they were the part less ready for inclusion anyway). Everything concepts can do can already be done in C++03 with SFINAE with expressions (which, thankfully, was required explicitly in C++0x unlike C++03 which is quite vague on that topic).

    Lambdas are monomorphic, thus useless. Even a DSEL can do better. Worse, even MACROS can do better (since there is no stupid limit on templates being declared at file scope anymore).
    Rvalue references is just broken magic; relying on NRVO works just fine to implement move semantics and is not as senseless.

    The only real update that comes with C++0x is fixing the standard library so that it doesn't require stuff it doesn't need. Nothing developers haven't already solved by implementing their alternative to the standard library.

    Yet, C++ remains the most awesome language ever.
    Too bad the committee isn't working on actually useful additions, such as virtual templates, which would allow it to compete with dynamic typed languages such as Python.

  64. Re:How about a REAL C++ feature.... by shutdown+-p+now · · Score: 2, Insightful

    eg. If you're Doing It Right then it's impossible to get a "buffer overflow" in C++.

    Is it? STL iterators (and therefore containers) do not guarantee (and usually don't provide) any bound checking, so they aren't really any safer than good old memcpy in that respect.

  65. Re:How about a REAL C++ feature.... by shutdown+-p+now · · Score: 3, Interesting

    The use case for auto is stuff like this:

    std::map<std::string, std::vector<int> > m;
    for (std::map<std::string, std::vector<std::int> >::iterator i = m.begin(); i != m.end(); ++i)

    There's absolutely no good reason why I have to spell out the map type in full twice on two adjacent lines of code. Yes, one can use typedef, but it actually makes code harder to read (I'd rather see std::map<...>, and immediately know what is meant, than see MapOfFooBar, and try to guess if it's std::map, or std::multimap, or maybe one of the fancy Boost containers, or a custom class). With auto, this becomes:

    std::map<std::string, std::vector<int> > m;
    for (auto i = m.begin(); i != m.end(); ++i)

  66. Re:And nothing of value was lost by Joce640k · · Score: 3, Insightful

    The big problems with GC are:

    a) Resources are more than just RAM. All files, network connections, etc., have to be manually closed in Java. There's no way to automate this (no equivalent to C++ stack unwinding) and it ends up being more work than managing RAM in C++ (where the compiler does 99.99% of the work for you).

    b) Even if you're only managing RAM, a garbage collector will totally destroy your performance if you run out of it and start paging to disk. To me, anything which continually scans the entire heap when you're out of RAM is a showstopping problem and makes GC useless for real applications.

    --
    No sig today...
  67. Re:How about a REAL C++ feature.... by shutdown+-p+now · · Score: 4, Informative

    Take a look at something like Acronis TrueImage (or any Norton program) before/after their transition from C++ to C++-with-C#-user-interface.

    As someone who worked in Acronis, and wrote a bunch of code for True Image, I feel obliged to tell you that there's no C# code in it at all - it's all pure C++. Acronis SDK (which is a separate thing, and IIRC comes only with True Image Enterprise) has component that exposes .NET API, and that's written in C#, but it's separate from True Image proper, and those C# APIs are just sanitized wrappers on top of the original COM API (which is implemented in C++), and, in fact, most of C# code there is automatically generated from COM interfaces (I know that because I'm the guy who originally designed that part of it).

    As for GUI in True Image (and pretty much all other Acronis products) - it's FOX Toolkit, or rather, forked and heavily-customized version of it (since it's LGPL'd, you can request the source code with customizations here).

  68. Re:How about a REAL C++ feature.... by shutdown+-p+now · · Score: 2, Interesting

    And there are times when you want the memory management code for performance, and you can't get to it.

    That's actually one thing I appreciate about C# over Java - it defaults to GC and memory safety, but it also has raw pointers with arithmetic, stack allocation, unions, and unchecked fixed-size buffers for when you need them.

  69. Re:How about a REAL C++ feature.... by Joce640k · · Score: 2, Insightful

    Code is complex, sure, but where does the RAM usage come from? At the end of the day the data being processed is a few kb of text and some bitmaps.

    --
    No sig today...
  70. Re:How about a REAL C++ feature.... by Darinbob · · Score: 2, Informative

    Yeah, the C with classes is a nice language. The C++ with std:: stuff can be a bit of a mess. The reason for arrays is that they're still much faster than vectors because compilers haven't figured out how to optimize a complex templates very well. If C++ wasn't used in an area where speed matters, then maybe you could get away with replacing fundamental types with compile time add-ons.

  71. Switching away from c++ is difficult. by tp_xyzzy · · Score: 3, Interesting

    Every time I try to start using some other language, it fails. Mostly because other languages do not provide necessary tools to build correct programs.
      1) java failed to support variables in stack, and the whole VM/GC thing is horrible.
      2) haskell failed in supporting for-loops (MapM_ is not exactly the same thing)
      3) erlang failed when it made it too difficult to use existing libraries made with some other language
      4) python failed when it's performance is not very good
      5) C# failed because it's from microsoft
      6) C failed because of it's lack of support for abstractions

    So I keep coming back to c++ every time. It provides combination of performance, low level programming, high level programming, good abstractions, rich tools to build your programs, proper tools for debugging your programs, plenty of libraries available, caveats are well known and workarounds exists, and it keeps working year after year without any compability problems in all supported environments.

    C++0x dropping concepts is a big news. This is because c++ is important. It also means that the concepts proposal was not good enough. Only the best proposals will survive. If concepts needs to go, then they go. C++ is too important to get ruin by proposals that do not work or leads programmers to deadends. Concepts looked like a fine proposal at first, but seems it was still not good enough.

    This might make other languages think they're progressing faster and providing new features faster. The other languages are still struggling to provide even basic support for things that programmers need. It's not the new features that the languages provide that determines if the language is useful. It's what the language fails to provide that counts. If there are big gaps in it's support, the tool is just unusable for use.

  72. Re:How about a REAL C++ feature.... by Joce640k · · Score: 3, Insightful

    Complete rubbish. Compiler writers aren't stupid, they know how to optimize std::vector. Go and disassemble some std::vector code before posting stuff like this.

    --
    No sig today...
  73. Re:How about a REAL C++ feature.... by Abcd1234 · · Score: 3, Insightful

    Yes, if you need to grow your business and all you can hire are dumb@$$3$ then yes, stick with Java (or C#).

    Wow, so all the programmers you hire are perfect little automata that never make mistakes? Impressive! Where did you find such miracles of science?

    And how much of a hit in performance are you taking when garbage collector turns on? How many times a minute does it fire and what happens to all those threads that are blocking?

    Depends on the GC. There's a reason Sun provides a bunch of alternative implementations which have various performance characteristics that are better for different workloads.

    On the flipside, how often do you see a crash because of a bad pointer reference, or worse, a security hole available to the world because of a buffer overflow in the code your perfectly little automata hacked up?

    There was a time when people expected computers to be fast.

    They also expect them to be stable and secure. Hint: speed isn't the sole requirement for most applications, and in fact isn't even the top one most of the time.

  74. The problem with C++ by Eskarel · · Score: 3, Insightful
    is that it's losing it's niche.

    The advantages of C and C++ have always been the speed of execution, and it's ability to get really close to the hardware. The problem now is that the speed of execution advantage is fading. Interpreted byte code languages like Java and C# are getting faster and faster, and they byte code has always made them more portable. Add to that that the extra complexity of C++ is often unnecessary, and you start reaching a point where more and more applications which would once have been written in C++ are now being written in C# or Java, this trend is only likely to continue with more and more applications moving onto the web, and continued improvements in the byte code languages themselves.

    There is certainly still a need for C and C++, they are really the only viable languages for writing device drivers and certain core OS components, not to mention all the interpreters necessary for running all these byte code languages. The problem, as I see it, and I'm by no means an expert, is that C++ is continually trying to compete with languages like Java, which it will never be able to functionally do without giving up all of the things which make it powerful and which java can't do. Java is powerful because you don't have to worry about all the things you don't really care about, and C++ is powerful because when you do need to care about them you have the level of control you need(C# tried to allow both, but it doesn't really work that way). The more libraries and features you add to C++ to make it like java, the more complex and bloated you make it, and you're still chasing an unachievable goal because you can't make C++ into Java and you wouldn't really want to.

    I'm not sure why the language is going in this direction, but it seems to me better to use C and C++ where they're appropriate and use Java/C# where they're appropriate and to stop trying to create some jack of all trades language which can't exist.

  75. Re:How about a REAL C++ feature.... by ardor · · Score: 2, Insightful

    Most of C++'s superior performance comes back once you start using metaprogramming. Note, modern C++ does not outperform Java because of low-level bit fiddling, it outperforms Java because of its ability to do work at compile-time. Once one starts to do this, it becomes apparent just how many class hierarchies actually never require run-time polymorphism (and only polymorphism at compile-time). As a result, the actual class hierarchies are dramatically reduced, because most classes in Java are just poor man's concepts (as in C++ concepts) or poor man's Haskell typeclasses.

    Also, C++ is multi-paradigmatic, and does not try to shoehorn everything into the OOP paradigm, which means the code can fit the problem better. For instance, I lost count of how often I use boost.lambda, or boost.phoenix, or bind, which all are sort of implementations of lambda.

    Then there are expression templates, which allows you to do things like matrix multiplications which even outperform Fortran.

    --
    This sig does not contain any SCO code.
  76. Re:And nothing of value was lost by ardor · · Score: 2, Insightful

    Include files are used as some sort of interface 99% of the time. Count the amount of include files without include guards. This means that include files are used in one limited way almost always. If headers are used like module interfaces, then it would be better to support modules in the first place.

    Plus, you have to manually take care that stuff isn't defined multiple times (which can happen even with include guards), templates have to be re-evaluated all the time, headers included in include files propagate and can affect compile time as well....

    As for why they are still around: backwards compatibility...

    --
    This sig does not contain any SCO code.
  77. Re:And nothing of value was lost by ardor · · Score: 2, Insightful

    No, because there is nothing that can replace it. Look at the range it covers. Give me a language that can replace this, and I'm truly happy, because C++ is not a shining beacon of light, C++ is a necessary evil until something can truly replace it.

    Oh, and mind the amount of C++ code out there I'd need to interface with. D is the closest thing out there, but it still falls short (well, perhaps until D 2.0 comes out).

    --
    This sig does not contain any SCO code.
  78. Re:How about a REAL C++ feature.... by chthonicdaemon · · Score: 3, Insightful

    Gotta have functions because expecting all programmers to know how to copy and paste large chunks of code when they use them isn't unfair to those who haven't gained those skills yet.

    When I'm programming, certain things set off red flags. If I see myself doing something similar many times, I extract that stuff into a function if "the thing" is parameterised by values. If it's parameterised in terms of types, I use a template, if there's obvious structure, I use a class. If it's small and gets done a lot, I use a loop. These structures are things that are not technically necessary for programming, but each mechanism cuts down on redundancy and reduces the chance of errors by having to remember where all the changes are. In addition, reducing the boilerplate makes it easier to see the structure in the program.

    The auto variable is an example of type inference, and the fact that C/C++ doesn't have it is really a nuisance once one has gotten used to languages with more powerful type systems like Haskell.

    --
    Languages aren't inherently fast -- implementations are efficient
  79. Re:How about a REAL C++ feature.... by spitzak · · Score: 2, Interesting

    He's only putting auto_ptr pointers on the stack, not whole objects. That is what he meant by "automatic".

    But also don't discount putting things on the stack. It's not a good idea if your functions are recursive, but for leaf functions it is. I just did some tests today, replacing a stl stringstream with a 256 byte stack buffer and using snprintf and it literally was 4 times faster. I wasted some time trying to improve the stringstream, by putting it outside the loop and clearing it instead of recreating it each time, and performance got worse (I think because the only way to clear it is to do s.str("") which created a temporary std::string and the compiler was too stupid to remove it). Changing the called code to take a const char* instead of a const std::string& did improve it about 1.5 times, but that was just doing a portion of the conversion to old fashined C code, and was still worse than the one that kept the std::string and used the buffer.

    Anybody who claims C++ stl stuff is just as fast is lying. They are safer (for instance nothing stopped me from sending the wrong number to snprintf, and my code did truncate if the answer was too big for the buffer, though I knew that the input (identifiers) would never be that long). But they are never faster, even compared to rather stupid code. I'm sure if I went and replaced snprintf with various strlcat calls it would be even better.

  80. Re:How about a REAL C++ feature.... by shutdown+-p+now · · Score: 2, Insightful

    Yes, but you will dump core with a bad_index or an assertion if you write outside iterator bounds instead of overwriting arbitrary memory, opening up opportunities for exploits.

    Except that you won't. Alright, checked iterators are an option, which is normally disabled by default in release builds in all implementations that I know of. So normally your std::vector iterators are just thin wrappers over pointers with no checking. And, of course, an implementation that checks iterators can check pointers just as well.

    In Java, C# or about any other language I've ever programmed indexing outside the bounds arrays or other containers will b0rk your program, it's all about _how_ it borks, and in that regard C++ code that only uses STL (properly) is pretty safe against buffer under/overflow exploits.

    To reiterate: there's absolutely no guarantee of that. Dereferencing an invalid iterator is U.B.; moving iterator before first element, or more than one past the last element in container, is U.B.; std::vector::operator[] with out-of-bounds index is U.B. The only thing that Standard guarantees is that std::vector::at() will throw if index is out of bounds, and almost no-one uses that (I've yet to see it in production code). It is absolutely not like Java or C#, where you're guaranteed that any out of bounds index, or any invalid iterator/enumerator, will throw upon use and not corrupt anything.

  81. Re:And nothing of value was lost by blancolioni · · Score: 4, Informative

    anything which continually scans the entire heap when you're out of RAM is a showstopping problem and makes GC useless for real applications.

    Luckily, GC has advanced since the 1960s.

  82. Re:How about a REAL C++ feature.... by PitaBred · · Score: 2, Interesting

    I know that. But C++ forces you to think about those issues, whereas Java/C# don't. That's why I recommend everyone at least learning a bit of C/C++, so they know where things come from. Do the development in Java, C#, Haskell, whatever. Have a ball. But realize that even if the language hides it from you, your structures and program still use resources. THAT is the problem I see coming from newer programmers.

  83. C++ 2010 is a great leap forward. by Jesus_666 · · Score: 2, Funny

    Actually, this is part of a bigger shift in the C++ development community. From now on, a new C++ core edition will be released each year, with names in the format "C++ ". C++ 2010 (or C10 for short) will also contain a major overhaul of the C++ rules, intended to make it so that user's guesses about how the language works will most likely be correct. Here are some of them:

    - The long and short keywords are now #defined as static. This fixes issues with respect to variables using these keywords going out of scope before all functions using them have resolved. It also keeps them from being used more than once for the same variable.
    - Some of the terminology is changed. "to declare" is replaced with "to put on the battlefield"; "to free" is replaced with "to send to the exile" (or "to exile" for short). This is to make the language less confusing for new users. Also, functions are no longer "called" but "evoked", bringing back some terminology from the early days of the franchise.
    - Local variables will no longer be exiled when a block ends. This mechanic has frustrated many new users (as almost nobody can tell without looking it up where a block begins or ends) and thus the developers have removed it. They are aware that this breaks some peoples' coding styles but really think it improves the language.
    - Local variables no longer use the stack. The developers felt that putting local variables on the stack could create unintuitive situations and thus moved them to the heap.

    All in all C10 will be the best version of C++ ever. Prerelease events will be held shortly.

    --
    USE HOT GRITS WITH STATUE OF NATALIE PORTMAN (NAKED AND PETRIFIED)