Slashdot Mirror


C++0x Finally Becomes a Standard

Samfer writes "On Friday August 12th 2011, the results for the final ISO ballot on C++0x came in, and the ISO C++ Standards Committee were unanimous in favor of approving the new C++0x (for now unofficially known as C++11) object-oriented programming language standard which is intended to replace the existing C++ standard. The new standard is to offer new and improved features such as lambda functions, concurrent programming functionality, direct data field initialization, and an improved standard library to name but a few." Although I haven't heavily used C++ in years, it is nice to see a decade long effort finally come to fruition. Especially nice is the support for type inference which should save quite a few people from RSI and make refactoring code a bit less obnoxious.

398 comments

  1. After... by wsxyz · · Score: 1

    After the standard is before the standard...

  2. Congratulations! by Anonymous Coward · · Score: 0, Interesting

    They said it couldn't be done!

    They doubted us!

    But we did it!

    The ugliest, most fragile, hackiest, most garbled, incoherent, biggest mess of a programming language is now even more so!

    1. Re:Congratulations! by Anonymous Coward · · Score: 5, Funny
    2. Re:Congratulations! by Anonymous Coward · · Score: 1, Funny

      Have you SEEN the stuff they're adding in the C++0x standard? Java has its warts, but it doesn't even come close to THAT level of horrific ugliness. I think APL is starting to have a competitor for unreadable code.

    3. Re:Congratulations! by Javagator · · Score: 1, Troll
      Have you SEEN the stuff they're adding in the C++0x standard?

      I have the same impression. A bunch of useless, error prone, legibility degrading changes to save a little bit of typing. In my opinion this is the worst standards committee ever.

    4. Re:Congratulations! by m50d · · Score: 1

      While C++ has and always has had plenty of crap in it, I still find it hilarious that C++ got lambda before java did.

      --
      I am trolling
    5. Re:Congratulations! by maxwell+demon · · Score: 2

      OK, so you consider concurrency useless? And lambda functions? And type inference? And strongly typed enums? And static assertions? And Unicode support? And variadic templates? And move semantics?

      The only pity is that concepts didn't make it in.

      --
      The Tao of math: The numbers you can count are not the real numbers.
    6. Re:Congratulations! by GooberToo · · Score: 1

      I hadn't thought of that, but your right, it IS damn funny!

    7. Re:Congratulations! by GooberToo · · Score: 1

      OK, so you consider concurrency useless? And lambda functions? And type inference? And strongly typed enums? And static assertions? And Unicode support? And variadic templates? And move semantics?

      Of course they don't. But they can't troll and sound like they have a legitimate grip is they actually spoke to reality.

    8. Re:Congratulations! by Bengie · · Score: 1

      They're getting C++ ready for a heterogeneous computing system. Can you imagine hand rolling code that will leverage an integrated GPU, a discrete GPU, a co-processor, and a 32 thread main CPU? Are you going to manage allocation copying and deallocation across all those devices?

      Remember, in the next decade, we may see hundreds of computer configurations with mixtures between Intel larrabee, AMD Fusion, multiple GPUs, and even cloud computing as an extension of the computer. You will be able to write code once and it will not only run on it all, but it will also leverage all the resources available. Hand coding that would be a nightmare.

      You're looking at the past when you should be looking at the future.

    9. Re:Congratulations! by Javagator · · Score: 0
      OK, so you consider concurrency useless?

      No

      And lambda functions?

      Yes

      And type inference?

      Especially type inference. Now we can write

      var area = 0;

      Instead of

      double area = 0;

      Did you catch the problem with the first statement? You can’t from context. It would pass the compiler and introduce subtle errors in you code as the “area” variable is always truncated to int. All so you can type var instead of double.

    10. Re:Congratulations! by Haeleth · · Score: 2

      Especially type inference. Now we can write

      var area = 0;

      Instead of

      double area = 0;

      I think you mean

      auto area = 0;

      in that first example.

      And you're being ridiculous. Anyone who types that is an idiot and deserves everything they get. The actual nice thing about "auto" is that you can type

      auto it = container.begin();

      instead of

      std::unordered_map<std::string, std::vector<std::string>>::const_iterator it = container.begin()

      without having to faff about with typedefs all over the place.

    11. Re:Congratulations! by cheekyjohnson · · Score: 1

      I know. It's awful! They're holding us at gunpoint and making us use all of the features we don't like!

      --
      Filthy, filthy copyrapists!
    12. Re:Congratulations! by Javagator · · Score: 1
      you're being ridiculous. Anyone who types that is an idiot

      There are are a lot of examples for type inference that do exactly that. I would still rather have a more verbose and informative typedef in code that I am reading than the word "auto".

    13. Re:Congratulations! by GigaplexNZ · · Score: 1

      While I partially agree with you to some extent, it's not always possible to do that with heavily templated code.

  3. Re:C++0xB by billstewart · · Score: 1

    Unofficially, ours increments up to eleven!

    --

    Bill Stewart
    New Fast-Compression-only CPR http://preview.tinyurl.com/dy575ks
  4. nice, but still missing... by StripedCow · · Score: 2

    List of missing features:

    - coroutines
    - multi-stage/active library programming (i.e., something that fixes the syntactical mess of most template libraries)
    - precise garbage collection (not that I'm missing it)
    - fully opening up of the memory model (allowing libraries to implement complex memory handling such as garbage collection or persistence)

    --
    If Pandora's box is destined to be opened, *I* want to be the one to open it.
    1. Re:nice, but still missing... by calzakk · · Score: 1

      There's always C# if you want garbage collection.

    2. Re:nice, but still missing... by Anonymous Coward · · Score: 0

      Heck, I just want to be able to do a dynamic allocation with a specified alignment and control the construction order of my global variables in a portable way. I've given up on complete memory ordering and barriers.

    3. Re:nice, but still missing... by Anonymous Coward · · Score: 0, Insightful

      What is it with lazy/shitty programmers and garbage collection?
      If you can't be bothered/figure out how to free memory when you're done with it do the rest of us all a favor and stop programming.

    4. Re:nice, but still missing... by Anonymous Coward · · Score: 0

      Funny, I feel the same way about A.C. posts...

    5. Re:nice, but still missing... by 0123456 · · Score: 1

      If you can't be bothered/figure out how to free memory when you're done with it do the rest of us all a favor and stop programming.

      Indeed. Garbage collection solves a few problems by creating a huge pile of new ones, like objects staying around when you thought they'd gone because someone somewhere still has a reference to them, or randomly disappearing because you forgot to keep a reference to them.

    6. Re:nice, but still missing... by Anonymous Coward · · Score: 0

      Proposals for garbage collection in C++ were for conservative (as opposed to precise) garbage collector.

    7. Re:nice, but still missing... by elrous0 · · Score: 3, Insightful

      You lazy, spoiled punks with your Java and C# garbage collection. Back in my day, we collected our OWN garbage. It was a miserable task, but we were ignorant and didn't know any better. AND WE LIKED IT!

      --
      SJW: Someone who has run out of real oppression, and has to fake it.
    8. Re:nice, but still missing... by Anonymous Coward · · Score: 0

      ...allowing libraries to implement complex memory handling such as garbage collection or persistence...

      What's stopping you from writing custom allocators?

      - T

    9. Re:nice, but still missing... by Canazza · · Score: 2

      What is it with lazy/shitty programmers and superfluous references?
      If you can't be bothered/figure out how to keep track of your objects do the rest of us all a favor and stop programming.

      --
      It pays to be obvious, especially if you have a reputation for being subtle.
    10. Re:nice, but still missing... by Anonymous Coward · · Score: 1

      If you can't be bothered/figure out how to free memory when you're done with it do the rest of us all a favor and stop programming.

      But then who would work on firefox? /joke

    11. Re:nice, but still missing... by wsxyz · · Score: 1

      And if you "forget" to keep a reference to your objects when you don't have garbage collection, what happens then?

    12. Re:nice, but still missing... by Bengie · · Score: 1

      "or randomly disappearing because you forgot to keep a reference to them"
      Really? That's an example why GC is bad? I think losing track of your data is poor programming, no matter which language you use.

      "creating a heap of new ones" fixed by adding pun

      But really, memory leaks with a GC is much easier to debug. There's very few corner cases to "leak" with a managed language.

    13. Re:nice, but still missing... by superwiz · · Score: 1

      It's not about laziness. It's about dealing with unpredictability. Most modern C++ programs have to deal asynchronous entry into destructors. Mostly due to uncaught exceptions being thrown from multiple threads. If you don't use some automated mechanism for dealing with it, half your code would be dedicated to it. Not taking care of things which can be done machines is a sign of a good programmer. Oh, and programmers who aren't lazy are bad. In fact, very bad.

      --
      Any guest worker system is indistinguishable from indentured servitude.
    14. Re:nice, but still missing... by NumLuck · · Score: 4, Informative

      - precise garbage collection (not that I'm missing it)

      What is the matter with everyone wanting a garbage collector? Personally, I find smart pointers to be far superior to garbage collection and the new standard now incorporates them in the STL (strongly influenced by BOOST)! With them, the sole idea of garbage collection in C++ is somewhat useless and obsolete.

    15. Re:nice, but still missing... by Anonymous Coward · · Score: 1, Insightful

      Actually, people did garbage collection themselves because the horrendous waste of resources to have a separate thread, that knows little to nothing about what you're using your resources for, trying to manage them is outright fucking stupid.

      Then computers got fast enough that you could write entire applications in interpreted languages running inside of other programs that are bloated and slow (and buggy!) in and of themselves. At that point all of the "programmers" decided that it was okay to write shit code because an inefficient watcher thread could babysit their code without any serious impact to the system (unless god forbid it has an error and crashes).

      I'm pretty sure that's what you meant, right?

    16. Re:nice, but still missing... by dindinx · · Score: 0, Troll

      Do you really mean that c# is only a collection of garbage?

      --
      DindinX
    17. Re:nice, but still missing... by mangu · · Score: 1

      If you are able to reliably track your objects then why do you need garbage collection at all? If you are so sure you won't need that object from that point forward, why don't you insert a free() or delete instruction at that point?

    18. Re:nice, but still missing... by Anonymous Coward · · Score: 0

      When you use smart pointers, you are implementing a reference-counting garbage collector yourself, inefficiently, across your entire codebase.

      Reference-counting garbage collectors were state of the art in the Carter administration. The science has advanced since then.

      Also, if smart pointers are so awesome, why doesn't operator new() return one?

    19. Re:nice, but still missing... by SchroedingersCat · · Score: 1

      Yes, and back in those days 640k was enough for everyone.

    20. Re:nice, but still missing... by Anonymous Coward · · Score: 1

      Like I said originally.
      If you have memory leaks either you're too lazy to free the memory when you're done with it or too incompetent to figure out how.

      p.s. A.C. because I'm too lazy to register for an account, not all laziness is bad.

    21. Re:nice, but still missing... by TheRaven64 · · Score: 2

      Actually, reference counting garbage collectors are state of the art, but we're talking about concurrent reference counting with cycle detection, which is used in IBM's research GCs for embedded applications. That said, reference counting - as long as you have zeroing weak references - is good enough for 99% of cases. Especially if your compiler can optimise away redundant reference counting operations, clang does for Objective-C but no compilers do for C++...

      --
      I am TheRaven on Soylent News
    22. Re:nice, but still missing... by lgw · · Score: 3, Interesting

      Early on, the C++0x spec had "opt-in" garbage collection, which was perfect! You'd declare a pointer as a garbage collected pointer if you wanted that, but otehrwise no GC. That was useful for cyclic data structures, and otherwise you could ignore it.

      Sadly, missing from the final spec.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    23. Re:nice, but still missing... by Anonymous Coward · · Score: 1

      There's very few corner cases to "leak" with a managed language.

      And yet it's trivially easy to make Java and C# leak that have nothing to do with exploiting corner cases. One of the most common sources of leaky .NET programs is people who forget to cleanup non-managed resources and you get things like GDI handle exhaustion because people like yourself are too lazy to learn to manage your memory and don't realize you're leaking handles like crazy. And that has nothing to do with "corner cases".

    24. Re:nice, but still missing... by Atzanteol · · Score: 2

      I once felt as you do. After a month of coding Java and never having to worry every time I typed "new" I never looked back.

      --
      "Ignorance more frequently begets confidence than does knowledge"

      - Charles Darwin
    25. Re:nice, but still missing... by Anonymous Coward · · Score: 0

      Personally I think GC should be a library feature. There's a number of ways it can be implemented, none of which require language support beyond the raw C-pointer type that's already there.

    26. Re:nice, but still missing... by Anonymous Coward · · Score: 0

      Back in time I just incremented the heap pointer when I wanted memory and kept resetting it at the beginning of each loop of the main routine. Horrors. You kids have it so easy..

    27. Re:nice, but still missing... by maxwell+demon · · Score: 1

      - coroutines

      If with "coroutines" you mean multithreading, C++0x has it.

      - multi-stage/active library programming (i.e., something that fixes the syntactical mess of most template libraries)

      I have no idea what "multi-stage/active library programming" is, so I cannot comment on that one.

      - precise garbage collection (not that I'm missing it)

      If you are not missing it, why do you want it?

      - fully opening up of the memory model (allowing libraries to implement complex memory handling such as garbage collection or persistence)

      C++0x has some support for optional garbage collection. Completely specifying the memory model isn't possible because C++ is compiled to native code, and different architectures have different properties. Imagine they would have fixed the memory model back in the DOS days!

      --
      The Tao of math: The numbers you can count are not the real numbers.
    28. Re:nice, but still missing... by GooberToo · · Score: 1

      With smart pointers and RAII, that's in fact what most C++ coders do.

      The reason why some want GC is become for small applications, it can speed development and runtime performance (saving you from optimizing). This is one of the things with many Java benchmarks whereby they purposely attempt to create the false illusion that Java is so much faster than other languages - in that they purposely attempt to defer object destruction. Its true a tiny subject of applications will benefit from this but of course, these benchmarks purposely avoid the C++ facilities to allow C++ to stomp java in the ground in these same benchmarks.

      There are certain classes of applications which benefit from GC. Most do not, especially with modern C++ facilities. Basically, if you can manage to screw up memory management in C++, without GC, I fully expect you'll manage to screw up memory management in any other language which supports GC.

      As an example, I was a member of a 20 man development team and a rather large c++ code base. When it came time for integration testing, we discovered a memory leak. Investigation revealed it was actually two leaks. It was finally nailed down to leaks in the platform. Number of memory leaks on a large C++ project? Zero.

      Years ago I remember a Java benchmark which claimed to be faster than C++. And it was. It was almost 3x faster. I took the C++ code, unchanged, adding a GC to it, and suddenly the C++ version was 3x as fast as the Java benchmark. Apples to apples, it was WAY slower. Now then, was a GC required to achieve that? Nope! It could have easily been done using any number of language features and libraries readily available for C++.

      These days, if memory leaks and hunts are a common problem for your C++ developers and/or projects, it absolutely is the developer's fault - not the language's. There is absolutely no excuse to have memory leaks, without GC'ing, using modern C++ methodologies.

      The simple fact is, almost exclusively only lazy programmers require GC. There are times where having GC available can speed development and even makes for an easy, lazy, optimization. Even still, there absolutely is no need for GC - especially not for C++. GC is just another tool in the bag.

    29. Re:nice, but still missing... by Jeremi · · Score: 3, Interesting

      After a month of coding Java and never having to worry every time I typed "new" I never looked back.

      Modern C++ programmers don't need worry about typing "new" either; they use smart pointers to handle the "garbage collection" for them. Works great, and avoids the unpredictability, overhead, and performance problems of a garbage collection thread.

      (yes, I know it's possible for reference-counting to leak if you introduce a cycle into the graph. That said, in the last ten years of C++ program, that problem has bit me exactly zero times)

      --


      I don't care if it's 90,000 hectares. That lake was not my doing.
    30. Re:nice, but still missing... by Imbrondir · · Score: 1

      My favorite missing is standardized name mangling. I still dream of the day I can use ctypes in python to import and manipulate c++ classes *sigh*

    31. Re:nice, but still missing... by bonch · · Score: 1

      Automatic memory management in some form is an inevitable future for most programming.

    32. Re:nice, but still missing... by Prune · · Score: 1

      Exactly. Smart pointers do better than garbage collection since they allow one to i) control reclamation much more flexibly (especially if using custom allocators and deleters), and ii) handle many types of resources other than memory; smart pointers is just the ligical completion of the RAII principle, really. Java GC is like an automatic transmission--you move the lever to select D and press the gas. And D is for "Dummy".

      --
      "Politicians and diapers must be changed often, and for the same reason."
    33. Re:nice, but still missing... by LateArthurDent · · Score: 1

      Frankly, I think that garbage collection is overused, and I would love to just have some variables declared such that the garbage collector will be responsible for clearing them, and other variables which I'm responsible for manually freeing. However, your examples are pretty much perfect examples of the advantages of garbage collection.

      Garbage collection solves a few problems by creating a huge pile of new ones, like objects staying around when you thought they'd gone because someone somewhere still has a reference to them...

      If some code still has a pointer to a memory location you've freed, you're going to run into trouble when they try to access it. You don't want that memory freed.

      ...or randomly disappearing because you forgot to keep a reference to them.

      Without garbage collection, that's known as a memory leak.

    34. Re:nice, but still missing... by Anonymous Coward · · Score: 0

      I'm sorry, but nowadays, C++ feels more like a "Windows ME" to me.
      A outdated system with new stuff bolted on left and right that goes far beyond what the language was originally designed to do. Bigger and bigger extensions, stacked onto each other like upside-down pyramid, bound to fall over all the time.

      I think every idea can only be evolutionary improved and polished so much, before there has to be a revolutionary rebuild from scratch.
      Some are better (because they are more general) and last longer. And some don't.

      For me, Haskell is this breath of fresh air. Consistent and elegant from ground up.
      So until its time is over too, I prefer that one, thank you very much.

      As Einstein said: If only engineers would do research, we would have perfectly functioning oil lamps today. (Own rough translation from German.)

    35. Re:nice, but still missing... by bames53 · · Score: 1

      What happens is that the resource is freed as required because you're using RAII.

    36. Re:nice, but still missing... by Anonymous Coward · · Score: 0

      smart pointers themselves can lead to uncollected loops as any reference counting system can and requires much more sophistication to avoid (using a garbage collection system for example).

    37. Re:nice, but still missing... by CountBrass · · Score: 1

      What is it with lazy/shitty programmers and templates, classes, multi-threading.

      If you can't be bothered/figure out how to implement all of the features of C++ you need using assembler then do the rest of us all a favour and stop programming.

      --
      Bad analogies are like waxing a monkey with a rainbow.
    38. Re:nice, but still missing... by CountBrass · · Score: 1

      What is it with lazy/shitty programmers and the crutch of assembly languages?

      If you can't be bothered/figure out how to programme by toggling switches on the front panel of a room-sized machine that requires the entire output of a small power plant to run then do the rest of us all a favour and stop programming.

      --
      Bad analogies are like waxing a monkey with a rainbow.
    39. Re:nice, but still missing... by rmstar · · Score: 1

      That said, reference counting - as long as you have zeroing weak references - is good enough for 99% of cases.

      You know, I am really glad to hear that, true to the C++ tradition, the committee has agreed to a 99% solution that will break in mysterious and irreproducible ways every now and then, leaving you few if any options when it does.[/sarcasm]

      The truth is that a GC was not added because it is fundamentally incompatible with the semantics of the language. This is a major weakness.

    40. Re:nice, but still missing... by flimflammer · · Score: 1

      Coroutines does not mean multithreading.

      I would certainly love for coroutine support to show up in more programming languages.

    41. Re:nice, but still missing... by Anonymous Coward · · Score: 0

      Jeez, don't get me started on the "large" object heap.

    42. Re:nice, but still missing... by Anonymous Coward · · Score: 0

      Mostly due to uncaught exceptions being thrown from multiple threads

      There is something wrong right here..

    43. Re:nice, but still missing... by Anonymous Coward · · Score: 0

      - inherited method call - super->method()....And even constructors, no matter that there is some partial implementation of constructor call inside the constructor
        - properties - FOR GODS SAKE. Any other stupid language has it. Why C++ does not!!!
        - clear distinction between Data classes and Action classes. With all the appropriate management of course.
        - RTTI. PLEASE, THIS IS C++, RIGHT? Then why not make RTTI a STANDARD feature!!!!!

    44. Re:nice, but still missing... by Anonymous Coward · · Score: 0

      One could say most modern languages are just that. Recycled ideas with polish, mashed up or mixed up like a mix tape. And yes, some of those are legendary. And yes, you can also polish a turd as the mythbusters proved.

    45. Re:nice, but still missing... by Estanislao+Mart�nez · · Score: 1

      What happens is that the resource is freed as required because you're using RAII.

      Except that if RAII frees the memory the pointer points at, and something else is using that memory, you've just broken your program.

      There are two solutions to this problem: (a) avoid sharing object references, which means that you're deep copying object graphs all the time and using more memory than you should need; (b) use a smart pointer that does reference counting—which is like GC, except crappy.

    46. Re:nice, but still missing... by Twinbee · · Score: 1

      The thing about .NET is that it still allows you to use pointers and non-managed code with no automatic GC should you so choose. Fancy that, combining both worlds into one language! It kinda makes the phrase "the right tool for the right job" passe.

      --
      Why OpalCalc is the best Windows calc
    47. Re:nice, but still missing... by mangu · · Score: 1

      The big problem with GC is that it kicks in at unpredictable times. When you do real time or time-critical applications this is a no-no.

    48. Re:nice, but still missing... by cheekyjohnson · · Score: 1

      Every single one of those features is forced upon you. How horrible!

      --
      Filthy, filthy copyrapists!
    49. Re:nice, but still missing... by Anonymous Coward · · Score: 0

      The great thing about GC, as implemented in Java or C#, is that you don't have to worry about it. You just write your program and everything works. With C++'s smart pointers, the programmer still has the additional cognitive load of having to know how everything works. Every time you use a pointer, you have to think about which of the half-dozen types of smart pointers to use (shared_ptr? auto_ptr? scoped_ptr? something else entirely?), and that pointer type gets baked into your API. What happens if you guessed wrong? When it turns out that can have circular references, you have to go and refactor your whole program. Of course, this means that it's even less likely that you can use a library without recompiling, because any change to how a smart pointer works means that you potentially have to recompile all the code you have that uses it.

      Still, even without the additional cognitive load, the CPU has additional work to do too. The actual incrementing and decrementing of reference counts isn't so much overhead, nor is the extra 4 bytes added to every object. The big problem is the extra locking that you have to do to make your shared pointers threadsafe. Every time you copy or delete a reference, you have to lock the bus and cause every CPU with the cache line containing that refcount to reload the whole cache line. This can cause false sharing even in data structures that ostensibly aren't even mutable!

      While not strictly having to do with garbage collection, typical C-style memory allocation is slow (having to walk a free list to find a hole of the required size) and inefficient (once a heap gets fragmented, behavior only gets worse until you have to terminate your process). There's no guarantee that two consecutive allocations will even be on the same page, let alone cache line. A compacting garbage collector not only has instant memory allocation (as fast as stack allocation in C) that puts consecutive allocations near each other in memory, but will compact objects to avoid fragmentation and improve locality.

      dom

    50. Re:nice, but still missing... by Anonymous Coward · · Score: 0

      Your comment about smart pointers in C++ is absolutely true. I would also point out that it is also true with, say, ResultSet's, Connections, InputStreams, OutputStreams, URL's, network sockets, SAX parsers, and about every other resource in Java, as well as all of the equivalent C# objects. All of these resources can dangle leaving, well, garbage, and the results of that for any real-world application are far more difficult to deal with than dealing with memory.

      IMHO, C#, Java, and all of the other sandboxed languages are not truly garbage-collected, because if they were, these resources would be handled just like memory. I would venture a guess that for all the flak that C++ takes, programmers who learn how to handle memory allocation and deallocation are far better at learning to handle other resources. Memory may be one more problem to deal with, but it isn't any worse than any other form of resource management. At least with C++, I have the option of dealing with the other resources that need to be freed at the same time that the memory is freed, and I assert that deallocating them will be far more efficient because I have that level of control, which isn't offered in any of the more popular languages.

    51. Re:nice, but still missing... by RzUpAnmsCwrds · · Score: 1

      Garbage collection is more efficient than reference counting most of the time. There are a number of tests that demonstrate that Java programs spend less time allocating and deallocating memory than C++ programs.

    52. Re:nice, but still missing... by Anonymous Coward · · Score: 0

      The original linux pthread implementation emulated multithreading by using coroutines. Real multithreading using pthreads was not supported until the native-pthread implementation was made. Coroutines can either be seen as generalized subroutines or as specialized threads. Coroutines do not exist on language level in C++ but they do exist on system-level. In other words, you already have them, what you want is a nicer syntax, something like Python generating function would be nice, and with lambda functions it should not be that hard an extention.

    53. Re:nice, but still missing... by Branciforte · · Score: 1

      After a month of coding Java, I figured out that there are many ways that a hidden reference can hold the entire memory graph hostage. Good luck tracking those down! before the code ships! If you're even bright enough to notice it on top of all the other memory that bloated Java code hogs up.

      I've never had a memory leak in C++. I use auto or smart pointers or else I add delete code in my destructor as soon as I add "new" statements. It that's too complicated for you, then maybe Java is more your speed.

    54. Re:nice, but still missing... by gbjbaanb · · Score: 1

      to be fair to Garbage collection, even they need smart pointers(warning long, but fabulous post. The safehandle 'fix' starts about 1/3rd of the way down). So assuming that GC is a magic bullet that somehow solves all your resource management and object lifetime issues is simply not the case.

      (remember GC is a system for collecting memory only, its poop at any other resource, RAII wins hands-down at that)(but I guess you could implement a GC-memory model underneath a RAII object-lifetime model, so an object gets destroyed in a deterministic manner, but the memory that was allocated to it gets frees lazily - that'd work, but it wouldn't give the magic bullet feeling to our less able developer colleagues :) )

    55. Re:nice, but still missing... by swillden · · Score: 1

      Exactly. Smart pointers do better than garbage collection since they allow one to i) control reclamation much more flexibly (especially if using custom allocators and deleters), and ii) handle many types of resources other than memory; smart pointers is just the ligical completion of the RAII principle, really. Java GC is like an automatic transmission--you move the lever to select D and press the gas. And D is for "Dummy".

      Yes and no.

      The ability to use a consistent methodology for handling all scarce resources is very nice, but there are some significant downsides to semi-automated memory management via smart pointers and the like as well. One obvious problem is memory leaks due to circular references. GC can clean up circular structures while smart pointers can't (efficiently). The biggest issue, though, is one of developer effort. Even with good smart pointers, it requires effort and discipline to plan and implement a memory management strategy with manual or semi-automated techniques. Developer time is much more valuable in most cases than machine time, so it makes sense to let the machine figure out when to deallocate stuff -- and in practice GC often consumes fewer processor cycles than manual deallocation. Lacking RAII, Java/Ruby/Python/etc. developers have to put more effort into management of non-memory resources than C++ developers do, but those other sorts of resources are used much less often than heap space, so the end result is less effort.

      The flip side is that sometimes the effort put into thinking about resource lifetime in order to manage it in C++ pays dividends in terms of better design. I've often seen that while thinking hard about what objects should live and die together, in order to figure out what sorts of pointers to use, I notice other elements of the solution structure and make choices that result in clearer and more maintainable code. But that's not really an argument for manual memory management, because it's absolutely possible to put in that same effort and reap the same rewards in a garbage-collected language.

      I think manual memory management is also contra-indicated for heavy parallel programming, which is going to become more and more the norm as core count rises. My opinion is that we're going to see a shift towards functional programming paradigms because from the developer's perspective they eliminate mutable data. In functional styles you "modify" data by making a copy with the changes incorporated into it, which largely eliminates race conditions and the need for locking. Of course, never modifying data in-place is hugely wasteful of memory, but it's the compiler and run-time that have to worry about that. They can figure out when it's safe to modify data in-place, and when it must actually be copied and the result is very efficient in programmer time and reasonably time and space-efficient as well. But that approach absolutely demands GC.

      In summary, there are pros and cons to both, but overall I think GC makes more sense for most software. Software that needs very precise control of memory consumption benefits from C++-style memory management, as does software whose primary task is managing non-memory resources, and there are probably some other categories that aren't coming to mind right now. Note that I don't think GC should be added to C++, though. The language would have to be changed too dramatically to make that feasible, in ways that would break it for software that needs manual memory management.

      --
      Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
    56. Re:nice, but still missing... by rioki · · Score: 1

      And for all those that *need" garbage collection in C++ there is still this: http://www.hpl.hp.com/personal/Hans_Boehm/gc/ Just saying...

    57. Re:nice, but still missing... by js_sebastian · · Score: 1

      - precise garbage collection (not that I'm missing it)

      Garbage collection does not come free:

      - Garbage collectors cause memory usage and CPU overheads. These can vary based on the used algorithms, but they are not negligible, are hard to predict, and are usually not deterministic/real-time. Given C++'s user base that includes users who REQUIRE C-like performance, this means garbage collection can only be an optional feature.
      - If a library or piece of code is built to use garbage collection, you cannot use it in a program without garbage collection. You cannot have garbage collection on for part of the program only (or at least, no good solution has been found for this yet). This means that optional garbage collection essentially splits the language into two incompatible dialects.
      - As a secondary point, destructors are not just about freeing memory, they also release other resources. With garbage collection, destructors are not called at a predictable point in time, which can cause trouble. This means the Resource-Acquisition-Is-Initialization paradigm that is commonly used by C++ code doesn't work reliably.

      PS; What the hell is wrong with formatting of comments? How am I supposed to insert a bulleted list? The FAQ is completely outdated (speaks of multiple comment modes that no longer exist, and normal ul/li tags do not work

    58. Re:nice, but still missing... by Jeremi · · Score: 1

      Garbage collection is more efficient than reference counting most of the time. There are a number of tests that demonstrate that Java programs spend less time allocating and deallocating memory than C++ programs.

      Interesting -- can you post a link to these tests? That sounds counterintuitive to me, and I'd like to understand how it could be.

      --


      I don't care if it's 90,000 hectares. That lake was not my doing.
    59. Re:nice, but still missing... by GooberToo · · Score: 1

      Agreed. Of course, that's also why the vast, vast majority of Java benchmarks attempt to run to completion before collection has a chance to run - thusly falsely elevating the Java benchmarks.

    60. Re:nice, but still missing... by epine · · Score: 1

      Nice ray of sunshine among the crap troopers. I agree that in large, professional teams the need for GC is almost non-existent.

      Where GC wins converts are the one-man programming teams where the programmer only has himself to blame and no group memory to navigate tricky semantics. C++ is hideous if you fall into the trap of using the wrong design method. Solo C++ programmers have trouble distinguishing design issues from code issues and end up blaming it on the language.

      For a small team, GC is like having a free, get out of "I was wrong" chit. Note that it doesn't make you smarter or better. It's like having a lazy professor who is soft on mediocrity: it frees you up to put more work into other courses without having to pad your workload with a business administration elective.

      C++ is an unusual language not in having the wrong balance of agendas/features, but because the sociology is impenetrable to the impatient minds of the lonesome or the quick and dirty.

      I've written many times on C++, and it's only becoming an even steeper uphill battle. C++ is the only language where you don't have to vote your ugliest agenda off the island. Obviously we are talking about an island that falls far short of tropical paradise, but there it is. C++ is the language of choice for people who say "good riddance" to "good riddance". That's not a zen statement, it's a dig at people who fail to understand generativity. What Newton failed to mention about the shoulders of giants is that the giants are uncomfortably contorted to stand erect in the mud of reality. Generativity is passing along the favour: accepting your tribulations and contortions gracefully for the sake of what will someday stand on *your* shoulders. Many of the quick and dirty are not so generous.

      The other thing that people don't appreciate is that GCC has lately been hindering C++ more than helping it, which is no particular fault of GCC but buried deep in standards lore.

      A long time ago when the earth was C, the standardization committee decided that the C language standard would NOT cover normative diagnostics. It was a point of contention among vendors who wished to use their diagnostic facility as a point of differentiation. Once the standard covers it, differentiation falls by the wayside.

      C++ inherited this decision and hasn't ever challenged it, much to its peril (retaining the sanity of its committee members in return). At first it was a rapidly growing language with puberty issues. Around the time when the STL was introduced, it became a muddle with great potential and horribly divergent implementations. And finally, there was this problem of unexpected riches. Those scary templates make the Rccp package possible. This is like the Ruby on Rails of high performance computing.

      Now the great thing about C++ is that the leetness of Rcpp can mostly be hidden from the R/C++ user. Except for those darn error messages, with no normative standard to guide the way.

      Clang/LLVM is going to fix that to a large degree, with or without concepts or standards support. Something concept-like needs to spring from the ashes of not-quite-there-yet, since C++ as a compile time language provides incomplete type checking at interface boundaries.

      This is no worse that R. Most of my R errors come from the hideously depths of 3rd party packages, where you can hardly even recognize the *purpose* of the evaluation context that puked out, because some package authors have figured out that inside R, there's LISP trying to get out.

      R operators [], []union of the two I'm happy as a pig in mud. Deep down I'm fairly certain that if any of 90% of the sentiment about C++ expressed on this thread had taken root in the C++ standards committee, I wouldn't now be enjoying the goodness and broad shoulders of Rcpp.

    61. Re:nice, but still missing... by NoOneInParticular · · Score: 1

      Yes, it's a major weakness of GC that it is not compatible with RAII.

    62. Re:nice, but still missing... by rmstar · · Score: 1

      Yes, it's a major weakness of GC that it is not compatible with RAII.

      No idea where you get that from. Search for unwind-protect and with-open-file. GC is fully compatible with RAII. The additional possibility of using finalizers with GCs actually provides more flexibility than RAII.

      GC 'enemies' are a lot like people who don't like vaccines or antibiotics.

    63. Re:nice, but still missing... by Atzanteol · · Score: 1

      I don't have a link off-hand but IIRC it has to do with being able to "batch" your collection being more efficient than doing it "on-demand." Here's a discussion that goes into a bit of detail WRT Python reference counting and Java garbage collection: http://stackoverflow.com/questions/21934/why-java-and-python-garbage-collection-methods-are-different

      --
      "Ignorance more frequently begets confidence than does knowledge"

      - Charles Darwin
    64. Re:nice, but still missing... by Atzanteol · · Score: 1

      Pffft! You C++ wienies and your wimpy high level languages! I suppose if doing assembly is too difficult for you then you should stick with C++ (can't even handle "C" eh?)! That's you. That's what you sound like. As though using your more difficult language were some sort of "badge of honor." I suppose you're exceedingly proud of some "Date" class you've written to while the rest of us in the real world like those sorts of things "out of the box."

      --
      "Ignorance more frequently begets confidence than does knowledge"

      - Charles Darwin
    65. Re:nice, but still missing... by Anonymous Coward · · Score: 0

      Which is why you should implement your own memory allocators if you want absolute performance from a heap bound system. Correct use of references would be a good practice as well, so that not everything is passed as value and the creation of temporaries is minimized. If your GC has pools of preallocated memory waiting, it is going to be fast in these cases.

    66. Re:nice, but still missing... by bames53 · · Score: 1

      Except that if RAII frees the memory the pointer points at, and something else is using that memory, you've just broken your program.

      If so then you're not really using RAII.

      A) Yes, you can avoid sharing references, and that might use more memory than is necessary, but then again, for a specific problem you may not need copies and so it could be efficient.

      B) Nice absolute there. Reference counting is a fine solution in many situations.

      There are other solutions as well:

      C) Use a non-reference counting smart pointer that allows resources to be passed around safely with no copying and no other overhead. See std::unique_ptr.

      D) Share references in a well defined way such that they're never passed outside the scope where the object is accessible.

    67. Re:nice, but still missing... by Anonymous Coward · · Score: 0

      Exactly! C++ has RAII, which means you don't NEED garbage collection. On the other hand, just because you have garbage collection doesn't mean you don't need RAII. Java for instance has garbage collection but no RAII, which is why I'll never be seen coding in Java unless I'm forced at gunpoint.

    68. Re:nice, but still missing... by Bengie · · Score: 1

      There is actually quite a few cases where a managed language is faster at allocation/deallocation than a unmanged language. Yes, there is overhead, but just like multi-threading, sometimes you sacrifice a bit of overhead for overall scalability.

      GC does remove some determinisim to memory management, but it does give a positive trade-off for situations where it's worth it, which is actually quite often.

      On the other hand, a GC does cause many programmers to become spoiled in application design and coding, but that's not a language problem.

  5. I'm just disappointed... by kervin · · Score: 1

    They didn't call it C++0b

    Oh and didn't include garbage-collection outright ( though they did design it with gc in mind ).

    1. Re:I'm just disappointed... by calzakk · · Score: 1

      Surely you mean C++0xb?

      C++0b implies octal, but b isn't an octal digit.

  6. oh hell... by Anonymous Coward · · Score: 2, Funny

    ...the 11th plague of Egypt has arrived a little bit late.

  7. C++0x by BasilBrush · · Score: 1

    How do you pronounce that? It's like they want to advertise that this is a baroque language.

    1. Re:C++0x by Anonymous Coward · · Score: 0

      At last, kids--a cheap excuse for saying "cocks" and not getting called down for it.

    2. Re:C++0x by Anonymous Coward · · Score: 1

      It's pretty easy to pronounce after you realize that the plus signs are silent.

    3. Re:C++0x by Anonymous Coward · · Score: 0

      I believe it's supposed to be pronounced "C++ Oh Ex".

      Having said that, I like to say "C++ Hex", since 0x is the standard hexidecimal prefix in C++, and it also gives the language name a certain mystical, not to mention slightly evil, quality.

    4. Re:C++0x by Anonymous Coward · · Score: 0

      see plus plus oh ex?

    5. Re:C++0x by Canazza · · Score: 3, Informative

      C Plus PLox

      --
      It pays to be obvious, especially if you have a reputation for being subtle.
    6. Re:C++0x by bytesex · · Score: 3, Funny

      Wanted: A 'cocks' programmer. With seventy years experience.

      --
      Religion is what happens when nature strikes and groupthink goes wrong.
    7. Re:C++0x by Anonymous Coward · · Score: 0

      The plus signs are silent. It's pronounced Cocks.

    8. Re:C++0x by Anonymous Coward · · Score: 0

      Oh come on, I attended the University of South Carolina long before this came out.

    9. Re:C++0x by eyenot · · Score: 1

      I think that's the most worthwhile thing anybody mused about it so far, and is possibly the only thing a sane person could surmise about the language without waxing esoteric.

      --
      "Stratigraphically the origin of agriculture and thermonuclear destruction will appear essentially simultaneous" -- Lee
    10. Re:C++0x by Anonymous Coward · · Score: 0

      They should have agreed to adopt a name that isn't so god awful to say, but it would appear they doubled down.

    11. Re:C++0x by Anonymous Coward · · Score: 0

      The plusses are silent, so it's just pronounced "cocks".

    12. Re:C++0x by Anonymous Coward · · Score: 0

      How do you pronounce that?

      "Syntax error".

      Alternatively, "nuked the target". Huh? Just turn your head sideways and it looks like a bit like a mushroom cloud with a smoke ring rising over an x.

    13. Re:C++0x by Anonymous Coward · · Score: 0

      Sepplesox.

    14. Re:C++0x by Anonymous Coward · · Score: 0

      How do you pronounce that? It's like they want to advertise that this is a baroque language.

      It's not C++0x, it's C++11. And I suppose you can use "C plus plus eleven". In a few years when the new standard will be wildly used it will become plain "C++" again.

  8. Sadly, tragedy struck by AdmiralXyz · · Score: 3, Insightful

    As the inaugural copy of the reference manual for the new standard was being printed and bound, it underwent gravitational collapse due to its enormous mass and became a black hole, killing all the committee members. Stroustrup was quoted as saying that despite the misfortune, he still has confidence that the C++0x standard will help programmers be more productive and efficient.

    and WOOSH there goes my karma...

    --
    Dislike the Electoral College? Lobby your state to join the National Popular Vote Interstate Compact.
    1. Re:Sadly, tragedy struck by bonch · · Score: 1

      and WOOSH there goes my karma...

      No, that was the sound of the reverse psychology ploy. Declarations of doomed karma give karma!

    2. Re:Sadly, tragedy struck by LWATCDR · · Score: 1

      I was thinking the same thing. The orignal white book was only 228 pages. C++ made C into a huge language that makes Ada look compact! Some of the additions are handy but so much of it seems to be just tricks.
      Smaller and simpler seem to be a better way to go.

      --
      See my blog http://ilovecookes.blogspot.com/ for light hearted technical information.
    3. Re:Sadly, tragedy struck by Jeremi · · Score: 4, Insightful

      Smaller and simpler seem to be a better way to go.

      Nobody is stopping anyone from using plain old C, if that's what they want.

      Of course, many people just end up re-inventing portions of C++ when they do that.

      --


      I don't care if it's 90,000 hectares. That lake was not my doing.
    4. Re:Sadly, tragedy struck by Prune · · Score: 1

      With your logic, you might as well criticize current mechanical engineering because the formulas used to compute the safety margins of a bridge's construction are too complex, why don't we just round the numbers here and guesstimate over there, and it's just as good but we saved time.

      The language's complexity is one of necessity not Rube Goldberianism, and you cannot fault it that becoming an expert is difficult and requires a lot of effort, and that many people simply cannot become experts in it. Neither can everyone become a rocket scientist. If you don't need C++, don't use it, but don't critique those that choose it for particular tasks--and if you're an expert, it is suitable for almost any programming task due to its flexibility in programming paradigms and huge range of possible levels of abstraction. In the hands of a master, it has no competitor.

      --
      "Politicians and diapers must be changed often, and for the same reason."
    5. Re:Sadly, tragedy struck by JanneM · · Score: 1

      I agree with your greater point that complexity is not net necessarily a bad thing. But your bridge simile is flawed. Many other programmers - the majority in fact - do use "simpler formulas" without their bridges becoming any less safe for their purpose.

      C++ is one lf the most used languages in the world, and for good reason, but it does have an awful lot of cruft, odd corner cases and complexity for what it does. It is a big-n-tall language, for good and bad.

      --
      Trust the Computer. The Computer is your friend.
  9. 2 more years.... by gabereiser · · Score: 0

    ...before compilers support it :( It would have been nice to see even a rudimentary garbage collection included but alas... C++ programmers are the most stubborn...

    1. Re:2 more years.... by Anonymous Coward · · Score: 0

      It looks like gcc supports most of C++0x already.

      See: http://gcc.gnu.org/projects/cxx0x.html

    2. Re:2 more years.... by Anonymous Coward · · Score: 1

      You have RAII. You have smart pointers. Why would you need garbage collection? Only in very exceptional cases I think. The problem seems to be Java-Programmers who don't understand the concept of RAII.

    3. Re:2 more years.... by SplashMyBandit · · Score: 0

      The real problem is C++ programmers who don't understand the need to clean up heap-allocated memory in an asynchronous multi-threaded environment (who 'owns' the memory is a problem that can break both RAII and if the developer forgets to use a smart pointer somewhere [or uses a library that didn't use one] then you'll have problems - with garbage collection it is less of an issue and new garbage collectors like G1 are very efficient compared to the old days).

    4. Re:2 more years.... by fnj · · Score: 2

      Someone who actually gets it. Garbage collection is a crappy hack that caters to shitty, incompetent programmers. The kiddies should look up RAII. They might learn something.

    5. Re:2 more years.... by multipartmixed · · Score: 2

      > The problem seems to be Java-Programmers who
      > don't understand the concept of RAII.

      Don't worry, most of them probably don't understand garbage collection, either. They just think it's a magical black box that does magic things... and then look bemused when they have a core leak.

      --

      Do daemons dream of electric sleep()?
    6. Re:2 more years.... by Anonymous Coward · · Score: 0

      That's not very accurate. MSVC supports half of C++0x at best. Mainly the stuff that's easy to implement. http://wiki.apache.org/stdcxx/C%2B%2B0xCompilerSupport

    7. Re:2 more years.... by Lunix+Nutcase · · Score: 2

      Which is why many of them still write code that leaks memory even with a garbage collector. One of the worst offenders are the .NET programmers who write software that leaks GDI handles like crazy and cause all sorts of crashes and bizarre behavior because they didn't bother to learn anything about managing memory and realizing that *gasp* even in a GC language you still need to make sure to be careful that all your resources are being properly released. This is further compounded because there have been a number of bugs in .NET that have caused even well-written code to leak GDI handles.

    8. Re:2 more years.... by Lunix+Nutcase · · Score: 1

      How is it not very accurate when both lists say basically the exact same thing?

    9. Re:2 more years.... by Anonymous Coward · · Score: 0

      Variadic templates, constexpr, =default/delete for implicitly generated ctors/dtors, constructor forwarding, initializer lists, raw/unicode literals, template aliases, unrestricted union members. And thread-safe static initialization is missing too (from both lists).

      All of that and a few other features are missing from the VC team's blog post. Except for rvalues, decltype, static_assert and lambdas, most of those missing features are more important than what MSVC did implement.

    10. Re:2 more years.... by Anonymous Coward · · Score: 0

      It doesn't help that Microsofts documentation early on regarding various GDI+ handles was less than great. For instance, there was no indication that creating a GDI+ Brush or Pen object actually pulled from a finite resource.

      Even still it's very rare to see such resources run out from a .NET application, especially these days. The handles are freed by the garbage collector once collection is triggered. The actual window for you to run out of resources before a gen 0 collection is rather small.

    11. Re:2 more years.... by Lunix+Nutcase · · Score: 1

      Even still it's very rare to see such resources run out from a .NET application, especially these days.

      Actually it's not. There are still some very popular GUI toolkits built on .NET that will leak GDI handles.

    12. Re:2 more years.... by Twinbee · · Score: 1

      Isn't it good news then that C# for example supports garbage collection, but still lets you manage the memory if you prefer? I'm working on two projects at the mo, one mostly with GC, and one mostly without.

      (perhaps you forgot the rule of premature optimization, and easy trap to fall in to).

      --
      Why OpalCalc is the best Windows calc
    13. Re:2 more years.... by gbjbaanb · · Score: 1

      you'll find that critical finalisation is incredibly hard to get right. this is why Microsoft added smart pointers (safehandle) to .NET, they couldn't get it to work properly any other way. Now when you're fixing GC with a smart pointer you have to question whether RAII would have been a better system all along.

      Google for 'brumme safehandle' for his long blog post detailing exactly why it was added and what it does.

  10. Random links? by drb226 · · Score: 1

    What's with the random links in TFS? Specifically, why link to c2.com for "type inference" and intel.com for "lambda functions"? Wikipedia wasn't good enough for those?

    1. Re:Random links? by smellotron · · Score: 1

      pecifically, why link to c2.com for "type inference" and intel.com for "lambda functions"? Wikipedia wasn't good enough for those?

      Have you ever browsed around c2.com? It's great. Wikipedia is good as a generic "fail-safe" resource, but I'd rather see a deep subject-matter wiki being cited where appropriate.

      I imagine the Intel article was referenced due to its examples of syntax. It's more specific than a general encyclopedia entry on lambda functions.

    2. Re:Random links? by gl4ss · · Score: 1

      a bunch of random links is appropriate.
      that's what the new spec is anyways, syntax uglifying random additions.

      and then it'll still be better to write stuff in the end as if you were writing in '95, most of this new stuff is to help prototyping faster and bending to it not being obvious from the code itself what's everything that actually happens when it's run.

      how are you supposed to spell it btw, cocks? and for the love of god, university people don't start pushing this stuff on your students until 2020 please!(when they might get jobs where they might get to use compilers that support this stuff).

      --
      world was created 5 seconds before this post as it is.
  11. Clean cool crisp refreshing by Anonymous Coward · · Score: 1

    I've been looking at 'C' code lately. Clean, cool, crisp and refreshing Standard K&R 'C'.
    I see the small tight executables.
    The fast load times,
    The tiny memory footprint.
    And I ask myself, "What have we really gained with C++?" or any OOP language, for that matter.

    1. Re:Clean cool crisp refreshing by nemasu · · Score: 3, Funny

      Objects

      --
      I made an app! Shoutium
    2. Re:Clean cool crisp refreshing by Anonymous Coward · · Score: 0

      The ability for idiots who shouldn't be programming in the first place to use something *easier* at the cost of society at large.

      Security is also an elective in a CS course these days, but Web Dev is mandatory.

      Hmmmmmm.

    3. Re:Clean cool crisp refreshing by NoNonAlphaCharsHere · · Score: 1

      1) Multiple inheritance "it's a floor wax! it's a desert topping! it's both!"
      2) Operator overloading: because TimeCard + MoveTicket + WorkOrder is so much more readable
      3) Virtual destructors: because the concept is so easy to explain.

      Errrr. Give me a minute. I'm sure I'll think of something.

    4. Re:Clean cool crisp refreshing by codegen · · Score: 1

      In our program, security is covered in a core required course and web dev is in a technical elective.

      --
      Atlas stands on the earth and carries the celestial sphere on his shoulders.
    5. Re:Clean cool crisp refreshing by Niris · · Score: 1

      I would love for even that to be true. Fresno State doesn't offer any security classes currently (though they're looking into it) for their computer science course. Web Dev is a class offered for one of the elective strings, but it isn't mandatory as there's other course branches you can focus on which is cool.

    6. Re:Clean cool crisp refreshing by Brannoncyll · · Score: 3, Insightful

      Correction:

      2) Operator overloading: because

      Matrix A, B, C, D;

      A = A+B*C + A*D;

      is so much more readable than

      Matrix A, B, C, D;

      A.equals(A.plus(B.mult(C)).plus(A.mult(D)));

      .... oh wait, it is! This is why Java sucks and C++ rocks for scientific programming.

    7. Re:Clean cool crisp refreshing by Anonymous Coward · · Score: 0

      I had a program in C which did some preprocessing of a directory full of (large) text files every day. When the format of the files changed, I toyed with the idea of fixing the C program and then decided to just rewrite it in Ruby. It took about 45 minutes to write and test (and I'm not a Ruby expert by any means) and it's less than 100 lines, compared with the 1000+ line C program. I call it a win for Ruby.

      Though it is true that the C program ran to completion in about 20 seconds while the Ruby program takes 2 or 3 minutes to do the same job, but it's not a time-sensitive task so that doesn't matter.

    8. Re:Clean cool crisp refreshing by Anonymous Coward · · Score: 0

      Do not forget the real template mechanism and stuff like the typedef operator that are really missing in Java

    9. Re:Clean cool crisp refreshing by wsxyz · · Score: 3, Interesting

      But the winner is:

      (+ A (* B C) (* A D))

      Filter error: Don't use so many caps. It's like YELLING.

    10. Re:Clean cool crisp refreshing by rubycodez · · Score: 1

      false, objects can be done in C as pointers to structs with members pointing to data and structures.. In fact, that's how the early c++ "compilers" did it.

    11. Re:Clean cool crisp refreshing by rubycodez · · Score: 1

      "pointing to data, functions and other structures (objects)", that is

    12. Re:Clean cool crisp refreshing by bonch · · Score: 1

      You probably posted that comment using software written in C++.

    13. Re:Clean cool crisp refreshing by Artraze · · Score: 1

      K&R C? Like the one where parameter types are listed after the function declaration? I'll take C99, please.

      Otherwise, I agree. C++ and object oriented programming in general are a backwards way of programming that introduces a lot of mess and anti-patterns for the platform you're actually programming. Allocating global memory for local scratch space and string operations, for example, blows my mind.

      That said, there are nice points to C++. Templates offer some capabilities and a lot of readability one doesn't get with macros (and vice versa!). Operator overloads are often nice for 3D / scientific programming. And like it or not, inheritance is quite helpful when it comes to GUIs. I just wish people would approach these things as tool rather than necessities.

    14. Re:Clean cool crisp refreshing by ArcadeNut · · Score: 3, Insightful

      Encapsulation
      Polymorphism
      Productivity

      To name a few....

      --
      Visit the Arcade Restoration Workshop @ http://www.arcaderestoration.com
    15. Re:Clean cool crisp refreshing by NoNonAlphaCharsHere · · Score: 1

      Operator overloading is only useful for a miniscule number of BigNum math classes that have all already been written - ages ago. By the way, did you ever notice how Java overrides '+' for the String class? So you CAN use overloading in the language spec without exposing it to the world for ametuer abuse. My 2Â.

    16. Re:Clean cool crisp refreshing by superwiz · · Score: 1

      The ability for idiots who shouldn't be programming in the first place to use something *easier* at the cost of society at large.

      The ability of arrogant jerks who don't realize that trivial nonsense is not a neat trick (but it does trespass on others' attention span) to complicate trivial tasks, to ignore solutions to problems which have been around for 20+ years, to take pride in their ignorance a la 1990... meh... why do I bother is the question. You deserve you.

      --
      Any guest worker system is indistinguishable from indentured servitude.
    17. Re:Clean cool crisp refreshing by Anonymous Coward · · Score: 1

      C is object based. All these *.o files guess never meant anything to all these newer programmers.

    18. Re:Clean cool crisp refreshing by TheRaven64 · · Score: 1

      Not really. The main advantage of objects is the loose coupling. C++, by requiring you to put the implementation details in the header, lacks that. Adding a single method to a class in C++ can require you to recompile the entire code base. This makes code reuse very hard, and the C++ type system makes it even harder. There are a few things that C++ is good for, but not many.

      --
      I am TheRaven on Soylent News
    19. Re:Clean cool crisp refreshing by Anonymous Coward · · Score: 0

      Or examples like this one from the MPL docs:

      Now, if we want to compute the force exterted by gravity on a 5 kilogram laptop computer, that's just the acceleration due to gravity (9.8 m/sec2) times the mass of the laptop:

      quantity<float,mass> m(5.0f);
      quantity<float,acceleration> a(9.8f);
      std::cout << "force = " << (m * a).value();

      Our operator* multiplies the runtime values (resulting in 6.0f), and our metaprogram code uses transform to sum the meta-sequences of fundamental dimension exponents, so that the result type contains a representation of a new list of exponents, something like:

      mpl::vector_c<int,1,1,-2,0,0,0,0>

    20. Re:Clean cool crisp refreshing by CnlPepper · · Score: 1

      Wow, you learnt to use the right tool for the right job... and your point is?

    21. Re:Clean cool crisp refreshing by GooberToo · · Score: 1

      You can do objects via C but its hard to read, debug, error prone, frequently inflexible, and nowhere near as powerful as C++. Other than that, objects in C are a really good idea.

    22. Re:Clean cool crisp refreshing by TheRaven64 · · Score: 0

      Encapsulation

      You mean like how C encourages you to use opaque types in the header and hide implementation details, while C++ requires you to use the Pimpl pattern to do the same thing and forces you to expose implementation details in the header by default?

      Polymorphism

      See Apple's CoreFoundation framework for a good example of how this is done in C.

      Productivity

      Yup. Long compile times certainly make me more productive. Posting on Slashdot while a big C++ project takes 10 minutes to recompile because I added a field to one class in a header and triggered a complete recompile definitely makes me more productive.

      --
      I am TheRaven on Soylent News
    23. Re:Clean cool crisp refreshing by Anonymous Coward · · Score: 0

      ...And I ask myself, "What have we really gained with C++?" or any OOP language, for that matter.

    24. Re:Clean cool crisp refreshing by mangu · · Score: 3, Insightful

      It took about 45 minutes to write and test (and I'm not a Ruby expert by any means) and it's less than 100 lines, compared with the 1000+ line C program. I call it a win for Ruby

      Challenge accepted! I bet I could rewrite that program in less than ten lines of Perl code. Any takers?

      Seriously now, I've tried nearly every language I can put my hands on. I still use C when the going gets tough. One of the reasons is that C is not likely to change.

      I've done a lot of small systems in Python lately and, yes, for a small system I can get it going faster than in C. HOWEVER, now comes Python 3. They tell me now that I should have used "from future import division". Apparently I'm too stupid to read the proper documentation, it was clearly stated in PEP 947, or something like that, that the behavior of the division operator would change. It seems that I should read carefully every single one of those thousands of PEPs to make sure they won't pull the rug from under my feet.

      If I ever have to go through every division operation in a program to check which ones can stay as '/' and which ones have to be changed to '//' I will take the opportunity to rewrite that program in C, as, I can see it clearly now, I should have done from the start.

    25. Re:Clean cool crisp refreshing by wagnerrp · · Score: 2, Interesting

      The whole point of classes is that you have create a relatively static interface, and the internals can change around as much as you want. If you change the internals, then all you have to do is recompile that single cpp file and re-link. If you change the interface, then you very likely will need to change many other files to use the new behavior. If you are changing private methods and private variables frequently, perhaps you should instead store them in a private class defined only within the cpp file, so you aren't constantly changing that header.

    26. Re:Clean cool crisp refreshing by Artraze · · Score: 1

      That's not particularly true. Actually, C++ makes life, perhaps, slightly easier because you can do:
      class X;
      class Y { X * var; };

      vs. C where you'd have to write (note the repetition of naming the the word "struct"):
      struct _X;
      typedef struct _Y { struct _X *var; } Y;

      In either language, you only need to include the typedef where you're actually using it (i.e. not just a pointer), and so only have to rebuild those parts if you set up your headers sanely. Sure, in C you can throw a function prototype in a .c and not the header, but that's more pathological than helpful. C++ is really about as competent as C (esp. considering it's a superset of the latter), but most developers don't really have the knowledge / background / inclination to actually use it that way.

    27. Re:Clean cool crisp refreshing by superwiz · · Score: 1

      Shouldn't it be:

      (+ A (+ (* B C) (* A D)))

      or did you mean this:

      (+ (+ A (* B C) ) (* A D)))

      Filter error: Don't use so many caps. It's like YELLING.

      --
      Any guest worker system is indistinguishable from indentured servitude.
    28. Re:Clean cool crisp refreshing by wagnerrp · · Score: 1

      Why do you Polish always have to be so reverse.

    29. Re:Clean cool crisp refreshing by superwiz · · Score: 1

      Turn off intern'ing during development and only turn it on for releases. This will speed up compilation considerably.

      --
      Any guest worker system is indistinguishable from indentured servitude.
    30. Re:Clean cool crisp refreshing by superwiz · · Score: 1

      blah... inline.... not intern...

      --
      Any guest worker system is indistinguishable from indentured servitude.
    31. Re:Clean cool crisp refreshing by Anonymous Coward · · Score: 0

      I guess you've never written stream manipulators or stream insertion/extraction overloads. Or iterator classes. How can you claim to know C++ when you haven't made custom iterators before? That's like not knowing the English alphabet.

    32. Re:Clean cool crisp refreshing by Brannoncyll · · Score: 1

      There are no age-old libraries when you program on cutting edge megaflop and petaflop-scale supercomputers (Bluegene/P, Bluegene/Q, QCDOC) for high performance physics applications such as lattice QCD. Also the data analysis tools we use often require fits to ~20 parameter non-linear functions which would be virtually impossible to get right in Java syntax. For example check out some of the NNLO PQChPT fit forms on Bijnen's page.

    33. Re:Clean cool crisp refreshing by wagnerrp · · Score: 1

      Yup. Long compile times certainly make me more productive. Posting on Slashdot while a big C++ project takes 10 minutes to recompile because I added a field to one class in a header and triggered a complete recompile definitely makes me more productive.

      So compile using ccache, or more jobs in your make, or move those frequently changing headers to a private class so other code objects don't know when there is a change.

    34. Re:Clean cool crisp refreshing by Anonymous Coward · · Score: 0

      Challenge accepted! I bet I could rewrite that program in less than ten lines of Perl code. Any takers?

      I could rewrite it in one line of C. One really long line....

    35. Re:Clean cool crisp refreshing by tuffy · · Score: 1

      + typically takes more than 2 arguments, such as (+ 1 2 3)

      No need to make more calls to it than necessary.

      --

      Ita erat quando hic adveni.

    36. Re:Clean cool crisp refreshing by GooberToo · · Score: 1

      What?! Reasonable and sane discourse? With a valid counter point even? You must be new here!

    37. Re:Clean cool crisp refreshing by TheRaven64 · · Score: 1

      So compile using ccache,

      ccache only skips recompiling if the preprocessed output is the same. It makes no difference in this case.

      or more jobs in your make,

      The C++ compiler uses 500MB-1GB of RAM in each instance on nontrivial C++ code. Increasing the number of jobs is more likely to cause swapping and make it even slower than to give a real speedup.

      or move those frequently changing headers to a private class so other code objects don't know when there is a change.

      Sure, refactor 500,000 lines of (mostly) someone else's code. Good solution.

      --
      I am TheRaven on Soylent News
    38. Re:Clean cool crisp refreshing by m50d · · Score: 1

      No it isn't. Try writing a mathematical paper that way and submitting it to a journal.

      --
      I am trolling
    39. Re:Clean cool crisp refreshing by wsxyz · · Score: 1

      No, it shouldn't be either of those.

    40. Re:Clean cool crisp refreshing by GooberToo · · Score: 1

      Nice way to troll Python, which is completely unrelated to the topic at hand, with completely irrelevant and misleading information.

      You do realize that Python 3.x purposely broke capability with 2.x? And you complaining that a program which was written against 2.x *might* require some minor changes to run against an incompatible version 3.x? What is wrong with people...

    41. Re:Clean cool crisp refreshing by lgw · · Score: 1

      RAII is the main thing. It lets you make all code exception safe, and never have another memory leak or file handle leak, with none of that annoying garbage collection. Code becomes so much more readable (and secure) when errors are dealt with as exceptions, instead of every damn function call being an if block.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    42. Re:Clean cool crisp refreshing by lgw · · Score: 1

      Encapsulation

      You mean like how C encourages you to use opaque types in the header and hide implementation details, while C++ requires you to use the Pimpl pattern to do the same thing and forces you to expose implementation details in the header by default?

      A C++ class header is not the same thing as a C header - an interface is the same thing as a C header. It's one of the many tricky aspects of C++ if you think it's an extension to C.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    43. Re:Clean cool crisp refreshing by GooberToo · · Score: 1

      Who the hell has 16 cores and one gig of ram? These days, unless your application is extremely exception in compilation demands, most people easily have the resources to allow for concurrent compilation. Hell, people were compiling the Linux kernel with -6 and far more a decade ago.

      Blaming a language for underpowered woes is pretty sad. There's a reason why people constantly tell you to use the right tool for the job.

    44. Re:Clean cool crisp refreshing by Anonymous Coward · · Score: 0

      If I have to recompile everything that uses a class because that class now has one more PRIVATE member variable, that means I don't have compile time encapsulation.

      If I can crap all over the private members of a class object during a buffer overrun, that means I don't have run time encapsulation.

      C++'s encapsulation is a sham.

    45. Re:Clean cool crisp refreshing by GooberToo · · Score: 1

      With that line of thinking, all computers and all programming languages are "a sham."

      Wow! You're quite the idiot!

    46. Re:Clean cool crisp refreshing by SnarfQuest · · Score: 0

      What's wrong with

      ABC*AD*++

      Good old HP calculators.

      --
      Who would win this election: Andrew Weiner vs Andrew Weiner's weiner.
    47. Re:Clean cool crisp refreshing by Dutch+Gun · · Score: 2

      C++ is a powerful and pragmatic, but ugly and dangerous language. No doubt about it. I'm a game developer, so I'm either working on C++ in engine code (and a subset of C++ at that), or in higher-level languages such as C# or Python for tools.

      And of course, C++ is definitely a language that requires a significant amount of programmer discipline - more so than other languages, at least from what I've seen. At a personal and a company level, you need to develop some guidelines that keep you from walking into tar pits. For instance, there's never a good excuse to use multiple inheritance, except if you're using it for interfaces (pure virtual classes). And of course, avoid the diamond of death at all costs. For a C++ programmer with any experience at all, that's just common sense (and any good tutorial will warn newbies well away from that trap as well).

      Operator overloads? Don't use them stupidly, to be blunt about it. If I saw anyone using them inappropriately I'd say something during a code review, just like with any other bad coding-related decision.

      Virtual destructors? A dangerous corner of the language and a potential source of bugs to be sure. But the option to NOT use a virtual destructor (only pay for what you use) is the reason we use C++ for our low-level engine code.

      Nothing else is as fast and as portable, while still maintaining a reasonable level of abstraction for design and maintenance purposes. And frankly, one of the most important things about C++ is the ability to drop down to more functional-style programming when required to for optimization purposes.

      I actually began working on a new codebase for a small game I'm writing at home, and I decided to embrace a lot of new C++0x features at a very core level (something you don't see in many game engines). It's pretty interesting when you make heavy use of smart pointers / ref counting to manage your resources. With some programming discipline, it feels quite a bit like writing C#, which to me has always been quite enjoyable as a language.

      In the end, C++0x is a pretty big deal to those who use it, because even though boost is extremely portable, it's still not the standard. There's always a bit of a mental jump you have to make to adopt a third-party library as part of your core designs. Personally, I've been pretty impressed by what I've seen so far, and look forward to exploring more of the new features as they are adopted by the major compiler vendors.

      --
      Irony: Agile development has too much intertia to be abandoned now.
    48. Re:Clean cool crisp refreshing by Toonol · · Score: 1

      I think C++ code can be clean and tight, but you need to restrict yourself to a very stringent subset of the language... basically, C plus classes and scoping. Don't use overloading, don't use templates unless it's absolutely necessary, don't use pass by reference, minimalize multiple inheritance and such idealized OO complications.

      C is basically portable assembly. C++ should be portable OO assembly... but it has ballooned to the point that its strengths have become weaknesses.

    49. Re:Clean cool crisp refreshing by lgw · · Score: 1

      If I have to recompile everything that uses a class because that class now has one more PRIVATE member variable, that means I don't have compile time encapsulation.

      No language I'm familiar with has thta encapsulation in its 'class' implememtnation - what you're looking for is 'interface'. An interface has no private anything, no implementation, fixes the dependency issues that the pimpl patttern fixes, etc. You don't need an 'interface' keyword for this in C++ (though 'struct' is often used that way in recent code) because of its support for multiple inheritance.

      The C++ 'class' keyword (and 'struct', too) can be used to declare either a class or an interface. It's not that hard of a concept.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    50. Re:Clean cool crisp refreshing by Anonymous Coward · · Score: 0

      Lots of languages manage to not need to recompile everything touching a class just because the class's PRIVATE, ENCAPSULATED IMPLEMENTATION changed.

      Lots of runtimes manage to throw an exception on out-of-bounds array access rather than overwriting encapsulated members.

      C++ is garbage.

    51. Re:Clean cool crisp refreshing by rmstar · · Score: 1

      With that line of thinking, all computers and all programming languages are "a sham."

      Hm, no. There are significantly better languages that get this kind of thing (and many others) right.

      Wow! You're quite the idiot!

      Actually, the guy you replied to showed critical thinking and the ability to adequately judge a claim. What was your contribution again?

    52. Re:Clean cool crisp refreshing by GooberToo · · Score: 1

      What was your contribution again?

      Statement of fact. What was your contribution? More bullshit and hand waving while pretending others used "critical thinking". If offering factually bullshit statements pass as, "critical thinking", in your book, you're an idiot.

      Re-read what he (you?) said. No fucking language protects against memory overwrites. So please, point me to the language which has every object inside of read-only memory.

      Basically, and what a surprise I'm saying it again, the offer what the idiot claimed means every fucking computer and language is non-viable. He's and idiot. And you are too for supporting such idiotic claims.

    53. Re:Clean cool crisp refreshing by emt377 · · Score: 2

      Not really. The main advantage of objects is the loose coupling.

      No, the main advantage of objects is namespace hygiene.

    54. Re:Clean cool crisp refreshing by neokushan · · Score: 1

      Just because you can use a tool incorrectly does not mean that the tool itself is bad. You can use a hammer to eat pasta with, if you really insist. It'll take forever, you'll probably lose a tooth and if used really poorly, you can possibly even give yourself brain damage - but does that make hammers bad? Should we go back to just bashing shit with rocks? No.

      C++ has a lot of tools and just because you don't have a need for them or have no idea how to correctly use them, it does not make them useless, pointless or otherwise.

      --
      +1 IDisagreeSoHeMustBeATrollOrAnAstroturferOrAShill
    55. Re:Clean cool crisp refreshing by Anonymous Coward · · Score: 0

      You're doing it wrong. Really, really wrong...

    56. Re:Clean cool crisp refreshing by rubycodez · · Score: 1

      not true at all, plenty of major projects (like libxml2) use the c-struct-object idiom very cleanly, I find it is *easier* to read than C++

      you can even do templates!

    57. Re:Clean cool crisp refreshing by maxwell+demon · · Score: 1

      And of course, avoid the diamond of death at all costs.

      Why? There's nothing wrong with it. Just don't apply it to classes with non-virtual functions or data members. If you restrict it to pure interface type abstract classes and remember to always use virtual inheritance for them, you're fine.

      --
      The Tao of math: The numbers you can count are not the real numbers.
    58. Re:Clean cool crisp refreshing by DanTheStone · · Score: 1

      How is pass-by-pointer cleaner than pass-by reference? References eliminate the need to worry about supplied return pointers being null. Or do you think all functions should only have a single result? And templates get a whole lot cleaner if you're willing to typedef them. STL makes the language far more usable.

    59. Re:Clean cool crisp refreshing by UnknownSoldier · · Score: 1

      > C++ is a powerful and pragmatic, but ugly and dangerous language.

      Agreed. I love C++ (worked on a professional C++ compiler for a brief stretch), but C++ also sucks.

      Mike Acton has documented why C++ continues to sucks.

      - Typical C++ Bullshit
      http://macton.smugmug.com/gallery/8936708_T6zQX#593426709_ZX4pZ

      - Do not force shared data formats for exclusive purposes
      http://macton.posterous.com/do-not-force-shared-data-formats-for-exclusiv
      "However, Object-Oriented Design (OOD) and Object-Oriented Programming (OOP) have perpetuated this misguided belief that there is an ideal abstract data form where all transformations are given equal weight*. "

      The largest problem is that C++ is over-engineered (designed by committee.) Its like people don't know how to say no. I figure it will be 2040 before C++ removes the ass-backwards compatibility of 'long long', 'short', 'long double', etc. nonsense. How many more years do we have to wait before we get _one_ standard on name mangling??

      Cheers

    60. Re:Clean cool crisp refreshing by rmstar · · Score: 1

      No fucking language protects against memory overwrites. So please, point me to the language which has every object inside of read-only memory.

      You can have the former without the latter. I don't know, try ada, ocaml, haskel, etc.

      what the idiot claimed means every fucking computer and language is non-viable. He's and idiot. And you are too for supporting such idiotic claims.

      Here, a napkin. You are foaming at the mouth.

    61. Re:Clean cool crisp refreshing by spitzak · · Score: 1

      That syntax problem is fixed (the same way C++ does it) in most C compilers (unless you turn on pendantic mode).

    62. Re:Clean cool crisp refreshing by spitzak · · Score: 1

      The problem with C for structures is that the necessary data for structures is visible, making it ugly. Basically you have to do at least this:

      struct Object { TypeInfo* info; };
      // this does { i->info = info; return i}, may be a macro by using compiler features:
      extern Object* setInfo(Object*, TypeInfo*);

      extern TypeInfo Xinfo;
      struct X { Object base; ...};
      #define NEW_X (X*)setInfo((Object*)malloc(sizeof(X)), & XInfo)

      extern TypeInfo YInfo; // something else puts a pointer to Xinfo in this!
      struct Y { X base; ...};
      #define NEW_Y (Y*)setInfo((Object*)malloc(sizeof(Y)), & YInfo)

      You can arrange a lot more macros, but it is never going to get pretty.

    63. Re:Clean cool crisp refreshing by emt377 · · Score: 1

      Allocating global memory for local scratch space and string operations, for example, blows my mind.

      Note that this is the default behavior for some template libraries. They do permit replacing the allocator. And with C++11 lambdas you can perhaps provide a one-off allocator that returns a static/auto array. (At least in some cases. For some implementations of some containers.) That said, the STL and boost are overengineered horrors IMO, and I avoid using either. In 10+ years of programming in C++ I've seen STL algorithms used *once* - to random shuffle a vector. And jeez, I can write a random shuffle function and a test for it in 15min. I can't remember seeing any use of iterators where [] wasn't just as good; iterators are mainly used to iterate containers that don't serve any real purpose (like stl::list; useless for large data sets even compared to say a deque or f-heap, too inefficient compared to an stl::vector or a C++ array for small sets). The little things, like vectors (or static arrays with bounds checks) I roll my own in, oh, an hour or two. For the *big* data sets... well, those tend to be core to a program and demand attention beyond pulling a hashmap off a shelf. Like concurrency might really matter, freelisting of nodes, etc. Doing it with something off the shelf is more complicated than rolling it yourself. And it probably won't be a template. Boost is impossible to debug, failures are utterly mysterious. And it can make a lean 100k C++ executable bloat to 5M just like that. Its asynchronous network connections... *shudder*! How hard is it to implement a reactor/proactor pattern? Not very, at least for a good network/systems programmer who has done it a few times before.

      The things skilled programmers worry about is not how a language reads, or where it's meta this or that. Those are problems for college students. What matters is making the computer to *do* what it's supposed to - the quality of which is largely measured by 1) whether its full capacity is dedicated to the problem (e.g. by threading and not getting stuck around global locks or pipeline hazards), and 2) how little other work it does (like copying memory where no copy is needed, including cache fills). The resultant ratio of effort to quality is a function of programmer ability, in particular experience and deep understand of the problem domain.

      I refused to switch from C to C++ for the longest time exactly because of misperceptions like it making automatic memory allocations - well, it doesn't. Some libraries do, but the same applies to C libraries. Just like there are C libraries I don't touch with a 10 foot pole there are C++ template libraries to avoid. C++ exceptions are mostly useless and cause grief and bloat - but they don't have to be used. The problem with exceptions is that they get used for things that aren't exceptional, like a TCP RST, while they can't recover from problems that truly are exceptional (e.g. out of memory, stack overflow, bus alignment error, wedged spinlock, lost interrupt). Between the two is a ridiculously thin error handling domain that really doesn't warrant its own language feature. RTTI is useless anyway, except dynamic_cast is useful for debug builds and some assert-level instrumentation. (Basically, it allows making type-based runtime asserts, in addition to the common value-based.) If I had had a an experienced programmer explain to me how to use C++ I would have switched much sooner. The code is so much cleaner. But I also refused to switch to C from assembler in the 80s, because of performance and code size. But eventually the value of code reuse won out and eventually I came to realize C compilers do nice things automatically; like if I make a small change it can completely reassign all register usage and enable/disable inlining, whereas manually I wouldn't bother until it got beyond a certain level or I really wanted to optimize some code path. Similarly, the stronger type formalism of C++ gives the compiler more information. Theoretically C++ also helps making better inlining decisions. If compilers could actually handle volatileness correctly as well then that should help code generation.

    64. Re:Clean cool crisp refreshing by siride · · Score: 1

      That's a different meaning of "object". In that case, "object" means "target" (as in, the object produced by the compiler). It has nothing to do with OOP. ...unless you were making a joke, in which case, carry on.

    65. Re:Clean cool crisp refreshing by Dutch+Gun · · Score: 2

      I guess I'll put it this way. I've never really seen a compelling reason where it should be necessary to do that where a saner design wouldn't suffice. I haven't had to break this rule during my career (at least, not that I recall - certainly not recently). Anytime I've gone down that path design-wise, a bit of thought usually leads me to a more elegant design anyhow.

      My rules may not be the same as other rules - hence, why I would never suggest they be codified into the language rules. To me, that's part of what makes C++ both awesome and dangerous at the same time. Part of the trick of using C++ is, IMO, extracting the subset of rules and idioms you're comfortable with and work well for you, and then using them consistently. No one should be using some language feature just because it's there, or because you can do it.

      Anytime I see someone trying to do 'clever' things with the language, I tend to cringe, because even if they save a few lines of code here and there, it often comes at the cost of maintainability down the road. It's taken me a long time to realize this, but boring code is beautiful code.

      --
      Irony: Agile development has too much intertia to be abandoned now.
    66. Re:Clean cool crisp refreshing by spitzak · · Score: 1

      It is useful to do operator overloading, as there are many things that have *not* been written (such as all kinds of variations on matrix math).

      I do think it is overused however, and C++ is somewhat unreadable. I would like the following:

      1. They cannot be virtual

      2. Limit the set. For equality tests you should only be able to overload = for free, automatically. Do whatever is obvious for the other items.

      3. Output should be done by a print(ostream) method instead of operatorostream.format("The answer is %x, %x, %12x", object1, object2, object3); would call object1.print(ostream), etc. The 'x' and '12' would be accessible from the ostream by the print functions. Hopefully the compiler features would be useful elsewhere too. The C++ i/o syntax is quite unreadable and lots of programmers resort to printf if they want to control number base or precision.

    67. Re:Clean cool crisp refreshing by emt377 · · Score: 1

      RAII is the main thing. It lets you make all code exception safe, and never have another memory leak or file handle leak, with none of that annoying garbage collection. Code becomes so much more readable (and secure) when errors are dealt with as exceptions, instead of every damn function call being an if block.

      Agreed, RAII is an excellent reason to use C++.

    68. Re:Clean cool crisp refreshing by spitzak · · Score: 1

      C++ requires you to recompile even if you add a private non-virtual member function. This should not be necessary as it does not change the interface, including not changing the memory layout or size of the object.

      I have certainly made bogus cut&pasted implementations just because I wanted to avoid a recompile, when a new private method that did the common part would have been useful.

      I would like to see the abilty to do "class X {int A,B,C'; void foo(); ...}" in a header file. Notice the ellipsis. This means "there is more stuff but if you have a pointer to the class you can call foo()". Right now doing "Class X;" is the same as "Class X {...};" so it appears the compilers would be perfectly capable of it. This would avoid a LOT of recompilation, and also make C++ more useful for long-term libraries where the calling code wants to work without recompilation.

    69. Re:Clean cool crisp refreshing by u17 · · Score: 1

      No, the main advantage of objects is convenient interfaces.

    70. Re:Clean cool crisp refreshing by buchner.johannes · · Score: 2

      There are some mature libraries like GObject (and Vala, Genie) that do objects for C.

      --
      NB: The message above might reflect my opinion right now, but not necessarily tomorrow or next year.
    71. Re:Clean cool crisp refreshing by Anonymous Coward · · Score: 0

      why do I bother is the question

      Exactly. By the AC's logic, everything above machine code could be considered a convenience just for idiots.

    72. Re:Clean cool crisp refreshing by RoverDaddy · · Score: 1

      In the picture I draw in my head, the 'diamond of death' isn't really closed at the bottom in the cases you describe. However, just because that base class obeys all the rules today, who says it still will tomorrow when the next programmer gets their hands on it? "What do you mean I wasn't supposed to use a data member there? It compiled didn't it?"

      --
      RETURN without GOSUB in line 1050
    73. Re:Clean cool crisp refreshing by maxwell+demon · · Score: 1

      That's what coding guidelines and code review are for.
      And someone who thinks that everything that compiles must be working code shouldn't be left near a compiler anyway.

      --
      The Tao of math: The numbers you can count are not the real numbers.
    74. Re:Clean cool crisp refreshing by Daniel+Phillips · · Score: 1

      false, objects can be done in C as pointers to structs with members pointing to data and structures.. In fact, that's how the early c++ "compilers" did it.

      As someone who has written a large amount of code in exactly that style, converting such a mess to C++ is always a welcome relief in terms of readability, maintainability and ability to further abstract. Just one concrete example: using C, if you define a struct that includes all the members of some other struct plus some new ones, using one of the new members is syntactically different from using one of the old ones (extra member dereference) so you can't do this transparently. A typical workaround is a mess of macros, need I say more.

      --
      Have you got your LWN subscription yet?
    75. Re:Clean cool crisp refreshing by Anonymous Coward · · Score: 0

      Not time-sensitive YET. Let's assume that the Ruby version is therefore using 6 to 9 times as much electricity to do the job. Now take the current attitude of programmers who have never been close to the metal: dozens of apps wasting huge amounts of time and running large runtime environments - constantly evicting the cache, and crippling the potential of multicore processors.

    76. Re:Clean cool crisp refreshing by maxwell+demon · · Score: 1

      3. Output should be done by a print(ostream) method instead of operatorostream.format("The answer is %x, %x, %12x", object1, object2, object3); would call object1.print(ostream), etc. The 'x' and '12' would be accessible from the ostream by the print functions. Hopefully the compiler features would be useful elsewhere too. The C++ i/o syntax is quite unreadable and lots of programmers resort to printf if they want to control number base or precision.

      Of course before C++0x, this would not have been possible since C++ lacked variadic templates, and objects cannot be passed through traditional variadic functions (there are technical reasons for that). In C++0x this could easily be implemented on top of the existing streams (except that format would have to be a free function instead of a member function).

      --
      The Tao of math: The numbers you can count are not the real numbers.
    77. Re:Clean cool crisp refreshing by maxwell+demon · · Score: 1

      How many more years do we have to wait before we get _one_ standard on name mangling??

      Name mangling is outside the scope of the C++ standard. Indeed, I consider name mangling a hack to get non-C++ aware linkers to correctly treat C++ code. In an ideal implementation, C++ names would not get mangled, but the linker would understand C++ types.

      --
      The Tao of math: The numbers you can count are not the real numbers.
    78. Re:Clean cool crisp refreshing by Daniel+Phillips · · Score: 1

      The problem with exceptions is that they get used for things that aren't exceptional, like a TCP RST, while they can't recover from problems that truly are exceptional (e.g. out of memory, stack overflow, bus alignment error, wedged spinlock, lost interrupt). Between the two is a ridiculously thin error handling domain that really doesn't warrant its own language feature.

      I would dispute your assertion that your latter domain is small. Maybe small compared to the domain of poorly written code, which always seems to be the largest domain of all, however what you are denigrating is precisely that which is required for truly robust applications which are also readable. Or to put it another way: if you are satisfied with applications that produce error messages not connected in any obvious way with the cause of a problem, then by all means don't bother with exception based error handling.

      --
      Have you got your LWN subscription yet?
    79. Re:Clean cool crisp refreshing by David+Greene · · Score: 1

      For instance, there's never a good excuse to use multiple inheritance

      Of course there is. There are plenty of reasons to use it beyond interface inheritance. "Never" is a very strong word.

      Virtual destructors? A dangerous corner of the language and a potential source of bugs to be sure.

      A destructor works like any other type of function. If you want the call to it to invoke the destructor on the concrete type, it must be virtual. It's really conceptually very simple.

      In the end, C++0x is a pretty big deal to those who use it

      Absolutely. Everyone complains about the warts of C++ and then when the committee goes and fixes some of them, everyone complains even more. I'm not enamored with the lambda syntax, for example, but it solves real problems in a pragmatic way.

      --

    80. Re:Clean cool crisp refreshing by mangu · · Score: 1

      You do realize that Python 3.x purposely broke capability with 2.x?

      Yes. When Niklaus Wirth wanted to improve Pascal he called the new version Modula. Then when he extended Modula he called it Oberon. Guido van Rossum should try to learn from the masters.

      If I could guarantee that i would have Python 2 available in the future separate from Python 3 I would have nothing against Python 3. The problem is that my programs that work in "Python" will present unpredictable bugs when someone changes some library I use from version 2 to version 3.

      C is so awesome because I can get a program I developed in 1985 for the PDP-11 and compile it today to run in an embedded processor somewhere, it will compile and run without problems.

    81. Re:Clean cool crisp refreshing by Anonymous Coward · · Score: 0

      It did become a great joke, as a reference to buggy, hastened releases.

    82. Re:Clean cool crisp refreshing by David+Greene · · Score: 1

      I would like to see the abilty to do "class X {int A,B,C'; void foo(); ...}" in a header file. Notice the ellipsis. This means "there is more stuff but if you have a pointer to the class you can call foo()".

      I like this idea a lot. It attacks a real problem in the language. Pimpl is all well and good but it is often too much overhead for small classes. I suspect someone has written a proposal for extensible classes. It would be interesting to research any past discussion about this kind of feature.

      --

    83. Re:Clean cool crisp refreshing by HornWumpus · · Score: 1

      The op codes could likely be packed into a less easy to use arrangement as well. Even x86 isn't completely de-optimized.

      Save bandwidth by requiring code to be compressed. Have the pre-fetch processor running PKware.

      --
      John McAfee 'It was like that time I hired that Bangkok prostitute; to do my taxes, while I fucked my accountant'
    84. Re:Clean cool crisp refreshing by WorBlux · · Score: 1

      There are probably is one or two mathematical journals that accept prefix notation in their style guides.

    85. Re:Clean cool crisp refreshing by Anonymous Coward · · Score: 0

      mmm, clean and tight, just like some good pussy.

    86. Re:Clean cool crisp refreshing by Anonymous Coward · · Score: 0

      Tradeoffs, tradeoffs, tradeoffs. With C++ it's not how big it is, but how you use it what matters.

    87. Re:Clean cool crisp refreshing by UnknownSoldier · · Score: 1

      > Name mangling is outside the scope of the C++ standard.

      Yeah, lets avoid the problem, by ignoring it. Real helpful ! NOT. And back in the real world, when you need to link multi-language objects you are the mercy of the compiler vendors. Is it really that difficult to communicate with other language implementations and reach a de facto standard or common consensus??
       

    88. Re:Clean cool crisp refreshing by lgw · · Score: 1

      You seem to have a different concept of classes than what they actually are. What you want (assuming only foo() is public):

      In the "public" header:

      class IMyClass
      {
      public:
        virtual void foo() =0;
      }
       
      IMyClass* CreateIMyClass()

      In a private header:

      class MyClass : IMyClass
      {
      public:
        virtual void foo();
      private
        int A, B, C;
        void ImplementationStuff();
      }

      Change MyClass all you want to, and none of your consumers need to recompile.

      The 'class' keyword isn't encapsulation by itself, you need to make interfaces (other languages have an 'interface' keyword to make the distinction clear).

      --
      Socialism: a lie told by totalitarians and believed by fools.
    89. Re:Clean cool crisp refreshing by Anonymous Coward · · Score: 0

      I have read your comment four times now and I still cannot figure out what point you are trying to make or what design your code is trying to implement.

      I have spent the last couple of months writing OO code in ANSI C. It does not require any macros or exposing any structure contents at all.

    90. Re:Clean cool crisp refreshing by David+Greene · · Score: 1

      Yes, it often is. That's why to this date there is still no Fortran I/O standard and no Fortran standard ABI. It is impossible to link Fortran objects created by multiple vendors' compilers and expect it to work. C doesn't even have a standard ABI. Why should we expect C++ to have one?

      --

    91. Re:Clean cool crisp refreshing by spitzak · · Score: 1

      Sorry, poorly stated. Pretend foo() is an inline function that we want to be fast. For instance:

        class C {
            int _foo;
        public:
            inline int foo() { return _foo; }
      ... // hides extra complex stuff that SETS _foo
        };

      All PIMPL or implementation subclasses will produce a MUCH less efficient version of foo() than the above code. This is a big deal for real production software, and often means that encapsulation and data hiding is abandoned because of the performance hit.

      Note that my idea still will not allow static or auto instances of the class, so it still has inefficiencies. I have no idea how to handle that, perhaps a linker could supply the object size at link time, but I would suspect that would still defeat most compiler optimization.

    92. Re:Clean cool crisp refreshing by euroq · · Score: 1

      You forgot to mention the preprocessor. People may love it, but it is a solution to 1960's technical limitations that is totally unnecessary today. D completely removed the preprocessor and none of the power, instead using "static" templates and functions and constants, etc.

      Oh, and header files. WTF? Header files? Why the fuck do I need to write it twice (or more)?

      --
      Just because the U.S. is a republic does not mean it is not a democracy. Democracy/republic are not mutually exclusive.
    93. Re:Clean cool crisp refreshing by kmoser · · Score: 1

      Syntactic abstraction, which (if properly used) leads to code that is more complex yet just as easy to read.

    94. Re:Clean cool crisp refreshing by dirtyhippie · · Score: 1

      clearly the main advantage of objects is subjective.

    95. Re:Clean cool crisp refreshing by euroq · · Score: 1

      C++ has a lot of tools and just because you don't have a need for them or have no idea how to correctly use them, it does not make them useless, pointless or otherwise.

      You know what? You make a great point. I'm not being sarcastic, that's absolutely correct.

      That being said, I think there is something to be said about the fact that tools shouldn't easily make people make mistakes. C++ is an old language (I consider it old because it's made to be compatible with C). Lots of languages have come around which improve on the language's features. There are always tradeoffs, but people are always trying to make it better. I think a lot of people's gripe with C/C++ that you see in these commentaries are valid, because the "power" that comes with C++ is actually possible in ways that are less likely to have people make mistakes when using it.

      If the great minds could come together and write a new language which is meant to be a competitor to C++ (i.e. not Java, Python, etc.), they would make a MUCH better language than C++. Check out D, it is exactly that (although I admit I've never used D professionally, so I'm not trying to say D is the trump card here).

      I guess my point is that, when you hear gripes about C++, it's not just because some developers aren't as awesome as the experts so they make mistakes... that's gonna happen no matter what language one uses. I believe that C++ is a language in which it is too easy to make mistakes, in the sense that another language would give a developer just as much power, but where that same developer of the same skill level would not make as many mistakes.

      --
      Just because the U.S. is a republic does not mean it is not a democracy. Democracy/republic are not mutually exclusive.
    96. Re:Clean cool crisp refreshing by euroq · · Score: 1

      Seriously now, I've tried nearly every language I can put my hands on. I still use C when the going gets tough. One of the reasons is that C is not likely to change.

      I think the mistake you made is that you said C, and not C++. C is a "bare bones" language which maps very closely to what a CPU's instructions do. Higher level languages tend towards how humans describe logic. C++ is basically a superset of C, which adds lots of powerful constructs (i.e. objects, templates, etc.), but still maintains the idea that it is a language which maps closely to what a real processor does.

      I believe that how C++ adds all of these powerful constructs is not the best way to make a "high level" i.e. "closer to human level" language but still maintain the "power" that C has (very close to how a CPU works). One example would be D, but I'm not going to say that that's the perfect language either. What I will say is that, the language of C++ is not the best language to do what C++ is supposed to do.

      --
      Just because the U.S. is a republic does not mean it is not a democracy. Democracy/republic are not mutually exclusive.
    97. Re:Clean cool crisp refreshing by maxwell+demon · · Score: 1

      Why should a Windows compiler and a Linux compiler and an OS X compiler be forced to use the same name mangling? Note that there are ABI standards for C++, although they are not published by ISO. There's e.g. the Itanium ABI (named that way because originally it was meant to be used on Itanium, but it's also used on other platforms, e.g. AFAIK all Linux compilers for x86 and x86-64 follow it, making it a de-facto Linux standard (indeed, gcc following it already makes it a standard for Linux). Since OS X uses gcc as main compiler (but shifting to LLVM lately), I guess they use the Itanium ABI, too.

      However note that vendors not using an ABI will be reluctant to switch to it because it breaks compatibility with all earlier versions of the compiler. Even formal ISO standardization wouldn't help much, because those vendors would most likely simply decide to not be standard conforming, or not be standard conforming by default, in this regard.

      --
      The Tao of math: The numbers you can count are not the real numbers.
    98. Re:Clean cool crisp refreshing by EsbenMoseHansen · · Score: 1

      2) Operator overloading: because TimeCard + MoveTicket + WorkOrder is so much more readable

      Of all the silly complaints, I've always found that one the most silly. The above is just as silly as TimeCard.add(MoveTicket).add(WorkOrder) --- a bad function name is a bad function name in any language.

      --
      Religion is regarded by the common people as true, by the wise as false, and by rulers as useful.
    99. Re:Clean cool crisp refreshing by EsbenMoseHansen · · Score: 1

      So I looked at the first set of slides. So yeah, I agree with a few of his points, mostly about design. The code would really benefit from using a more functional design style, and the cast to and from intenums are really weird, true, and he does point out some places where I would point valgrind to. And yes, I agree it is really bad that float/double/enums casts implicitly virtually all integer types and bool. But very little here has any bearing on C++, most of it is just bad design or bad C. In fact, the code he presents looks like the typical C-coder gone to C++ code.

      As for continues to suck: The poor design choices... well, those are hard to help. It should now be even easier to return enums (thanks to strongly typed enums) than before, and it should be even easier to accept multiple objects rather than just one. The casting issues are the same, and yes, I would love to have those fixed.

      --
      Religion is regarded by the common people as true, by the wise as false, and by rulers as useful.
    100. Re:Clean cool crisp refreshing by EsbenMoseHansen · · Score: 1

      This article is about C++. Why are you telling us you rewrote a C program in ruby?

      If you actually used C++, you were likely not using a library. That is the most common error in C++: Failure to search for and use libraries.

      --
      Religion is regarded by the common people as true, by the wise as false, and by rulers as useful.
    101. Re:Clean cool crisp refreshing by LizardKing · · Score: 1

      The coding standard at several jobs have enforced an avoidance of virtual methods unless really, really necessary on the basis that "we're using C++ for performance and virtual methods hinder performance". I have actually had code like your example rejected at code reviews, despite my explanation that such classes change relatively frequently, thereby forcing lengthy recompilation of significant amounts of code. The amusing thing is that there were much greater causes for concern when it came to performance, such as code being written without thread safety in mind and then wrapped in locks that caused serious amounts of contention.

    102. Re:Clean cool crisp refreshing by GooberToo · · Score: 1

      I've used them and written my own. They suck ass compared to the "real thing."

    103. Re:Clean cool crisp refreshing by Coryoth · · Score: 1

      I'm sorry -- what exactly are you trying to do? I've been writing OO code in ANSI C for a good 18 months without having to do any contortions like that.

    104. Re:Clean cool crisp refreshing by GooberToo · · Score: 1

      I can find nothing which supports your conclusion. These languages only run on systems with support protected, read-only memory? If not, as originally stated multiple times, you're full of shit.

    105. Re:Clean cool crisp refreshing by rubycodez · · Score: 1

      Nah, C objects can do what is usually thought of as very high level language-type things that Bjame Stroustrup's pansy-wimpified C++ objects could never dream of: duck typing, dynamic typing, mix-in methods, dynamic addition of methods, and even some aspect oriented tricks.

    106. Re:Clean cool crisp refreshing by Yunzil · · Score: 1

      The problem with operator overloading is that unless you have all the code in front of you, there's no way to tell what an expression does.

      Take your example: A = A+B*C + A*D;

      You can *guess* that this is doing some multiplications and additions, for for all you know '*' might be some crazy composition function, '+' might be a concatenate of some sort, and '=' might convert to base 13 before the assignment. The only way to know for sure is to know the types of everything there and look through the code. And even then you might have to go crawling up the whole class hierarchy to find the correct operation.

      Operator overloading is a curse.

    107. Re:Clean cool crisp refreshing by Brannoncyll · · Score: 1

      I agree that it is possible to obfuscate using operator overloading, but I don't see how denying the programmer access to this useful tool helps the issue. Can't a crazy Java programmer also make their 'mult' function concatenate in some strange way, or set their 'equals' function to convert to base 13?

    108. Re:Clean cool crisp refreshing by kat_skan · · Score: 1

      Not really. The main advantage of objects is the loose coupling.

      No, the main advantage of objects is namespace hygiene.

      AMONGST our advantages are such elements as loose coupling, namespace hygiene, an almost fanatical devotion to the Pope... I'll come in again...

    109. Re:Clean cool crisp refreshing by lgw · · Score: 1

      Virtual methods have almost no measurable impact on performance. It's amazing how bad people's mental model of a CPU is these days. Now it's all about limiting conditional branches and staying within L3 cache.

      Heck, the idea that anything that happens "in memory" matters performance-wise is usually wrong, unless you're talking about performance-path kernel code, or someone has really picked the wrong algorithm.

      As you say, lock contention is the usual reason processes can't max out the I/O buses.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    110. Re:Clean cool crisp refreshing by lgw · · Score: 1

      Sure, but usually you can put the needed inline code in your "interface" in C++ and still avoid the dependency traps, if peformance is critical for that specific function, since C++ doesn't have a stictly-enforced 'interface' keyword like Java or C# or the like to forbid that. There's a specific design pattern Stroustrup talks about in one of his books that you can use when you really need this (where you awkwardly use two half-classes), but it's been too long since I read that stuff.

      Optimizing (linear) performance without having identified a specific hot-spot in the code though profiling (or at least establishing that CPU is a bottleneck in the first place) is usually quite silly, of course. That sort of "save a call" efficiency almost never matters, at least for business code (scientific computation is a different world).

      --
      Socialism: a lie told by totalitarians and believed by fools.
    111. Re:Clean cool crisp refreshing by rmstar · · Score: 1

      I can find nothing which supports your conclusion. These languages only run on systems with support protected, read-only memory? If not, as originally stated multiple times, you're full of shit.

      These languages are better designed, and can ensure safety without running on systems with only protected, read-only memory. I conclude that this possibility is simply beyond your grasp and imagination. It is unfortunate (for you) that you can only resort to swearing and insulting to compensate for your lack of understanding. Are you always like that?

    112. Re:Clean cool crisp refreshing by spitzak · · Score: 1

      I think you are talking about PIMPL or some other scheme. All of them make inline functions not work.

      You can also do partial-PIMPL where anything you want fast is put in the main object, while all the changable parts of the implementation are put into the IMPL that the P points at. This can work, it is usually true that the fast portion is not changing. However it is ugly as the various data is in different structures for no other good reason.

      I am doing scientific computation (well actually special effects rendering) and I can tell you that saving the overhead of a function call, especially one that there is no chance the compiler will inline, is significant. Yes it is great and more important to replace an O(N^2) with O(Nlog(N)) function, but in the real world that happens rarely, and is a HUGE deal that results in all kinds of papers being written and everybody scrambling to do the rewrite to incorporate the speedup. Seemingly trivial linear speedups like this do add up, a lot. They are also necessary to stop lower-level programmers from doing their own speedups, such as copying the result into a local variable and making their code harder to maintain.

    113. Re:Clean cool crisp refreshing by lgw · · Score: 1

      PIMPL is ususally just a case of "I didn't understand how inheritance worked", Stroustrup would never suggest it (even when it was the right tool).

      Yup, when linear performance gains matter, you pretty much need a "public" class with all the inlines, and everyhting else you can expose without unneeded dependencies, and a "private" class derived from that for the rest.

      I find that an awkward workaround, and therefore a failing of the language, but I have yet to see a language that gets that right (and at least there is a workaround in C++).

      --
      Socialism: a lie told by totalitarians and believed by fools.
  12. According to google... by Anonymous Coward · · Score: 0

    The blog title "C++11 considered harmful" is still up for grabs.

  13. At this rate by jabberw0k · · Score: 2

    Perl 6 should arrive in 2019. p.s., As for lambada functions, I hear the best ones are in Buenos Aires.

    1. Re:At this rate by Ant+P. · · Score: 1

      Perl 6 has been around for years now. You can even run it in a browser if you're too stupid to operate synaptic.

    2. Re:At this rate by xvjau · · Score: 0

      As for lambada functions, I hear the best ones are in Buenos Aires.

      Either you think thank Lambada really sounds like Tango, or that Buenos Aires is the capital of Brazil. If the latter, I think Brazil should really just delcare war against the U.S.*, just to see those poor Argentinians get their capital nuked! :-)

      * yes, I assume that you are an American.

    3. Re:At this rate by cyfer2000 · · Score: 1

      At this rate

      --
      There is a spark in every single flame bait point.
    4. Re:At this rate by Anonymous Coward · · Score: 0

      Buenos Aires Massachusets? http://www.r6rs.org/ ?

      lua is a cheap clone and always will be!

      '() forever!

    5. Re:At this rate by Anonymous Coward · · Score: 0

      And lambada would be best at Rio de Janeiro not Buenos Aires

  14. C++ already has something better than GC by Anonymous Coward · · Score: 1

    RAII and reference-counting.
    I prefer using a program that doesn't periodically stop responding for several seconds, and shove all my other programs into swap, while it re-builds its heap.

    1. Re:C++ already has something better than GC by lowlevelio · · Score: 1

      Multi core has been standard several years, even on tablets now. And usually the total load on the system has cores to spare which can run GC without slowing down anything. GC = multi core optimized. native allocation/deallocation = single core optimized.

    2. Re:C++ already has something better than GC by maxwell+demon · · Score: 1

      But cores are not everything. Think about what GC does to the cache.

      --
      The Tao of math: The numbers you can count are not the real numbers.
    3. Re:C++ already has something better than GC by Anonymous Coward · · Score: 0

      If only concurrency between cores were easy!

    4. Re:C++ already has something better than GC by badkarmadayaccount · · Score: 1

      Split off the GC in a process. Have the OS remap memory. AID tags in the L1 cache are selectively flushable.

      --
      I know tobacco is bad for you, so I smoke weed with crack.
    5. Re:C++ already has something better than GC by HappyPsycho · · Score: 1

      I would question that GC = multicore. The fact that the GC would be across all threads makes it a shared resource which means it must be locked and lock what it is working on which will bottleneck the code it is GCing for or for any app that cycles through objects quickly be constantly playing catch up (with all the implications, including the ridiculous memory usage I often see on java servlets).

      I'll agree that a multi-core system will handle GC better than a single core I hardly think that qualifies it as multi-core optimized.

  15. Hey Look! It's That Shit Coder StripedCow! by Anonymous Coward · · Score: 0

    Go do php work dimwit.

  16. Speaking of obnoxious by drobety · · Score: 1

    make refactoring code a bit less obnoxious.

    Speaking of obnoxious, what's with the 'C++0x' name?

    1. Re:Speaking of obnoxious by Brannoncyll · · Score: 1

      I believe it is because they intended to finalise the standard within the first decade of this millennium rather than the second.

    2. Re:Speaking of obnoxious by TheRaven64 · · Score: 4, Informative

      The x is a placeholder. C99 was C9x before it was standardised. The two digits specify the year (See: C89, Fortran77, and so on) in which the standard is finalised. This is the version of the standard that will be finalised some time between '00 and '09. In common with all other C++ projects, this one was completed late.

      --
      I am TheRaven on Soylent News
    3. Re:Speaking of obnoxious by Anonymous Coward · · Score: 0

      0x was intended to be the last two digits of the year of release. Similarly to how we have C99, C++03, etc.

    4. Re:Speaking of obnoxious by bWareiWare.co.uk · · Score: 1

      Not only that but they STILL seem to be using 2-digit dates!

    5. Re:Speaking of obnoxious by TheRaven64 · · Score: 1

      That's just wishful thinking. We're all really hoping that C++ won't still be around in 2098...

      --
      I am TheRaven on Soylent News
  17. Nice, but maybe irrelevant. by Animats · · Score: 4, Interesting

    It's nice that they finally got the standard done. But there's so much junk in there. The C++ committee was dominated by people who wanted to do cool things with templates.

    Some years ago, someone figured out that it was possible to abuse the C++ template system into doing arbitrary computations at compile time. This developed a fan club. That fan club has dominated the C++ standards committee, because nobody else cared. So now we have a standard for C++ which supports template-based programming a little better.

    Current thinking seems to be that,while template programming is too hard for ordinary programmers, the templates will be written by l33t programmers and then be used by the lower classes. Unfortunately, if anything goes wrong, the end user has to look at the innards of the template to find the problem. We went through this with LISP decades ago. Check out the MIT Loop Macro, That finally became stable about the time LISP died out.

    Note what isn't in the new C++. There's no more memory safety than in the old one. (Fans will say that it's safer if you only use the new features. Now try to call some library that doesn't use them.) So the buffer overflow attacks and crashes will continue.

    C++ is the only language to offer hiding without memory safety. Hard-compiled languages from Pascal through Go have hiding with safety, as do all the major scripting languages. C has neither hiding nor safety; the pointer manipulations are right there in the source. There have been safe, hard-compiled languages without garbage collection, most notably Ada and the Modula family. Safety and speed are not incompatible.

    1. Re:Nice, but maybe irrelevant. by Anonymous Coward · · Score: 0

      (Fans will say that it's safer if you only use the new features. Now try to call some library that doesn't use them.)

      So you'd prefer if the language somehow magically converts all existing libraries to the safe style of coding?

    2. Re:Nice, but maybe irrelevant. by Kevin+Stevens · · Score: 1

      I think you hit the problems with templates nicely. While they were sitting around arguing over concepts, they could have been including support for multithreading. The new move semantics are nice, as are "official" smart pointers, though I am kind of cringing thinking about how much of a pain dealing with incompatibilities with boost smart pointers or other smart pointer libraries might be.

      With the exclusion of concepts, the latest standard just moves C++ farther into an experts-only language. The whole standardization process is just too cumbersome. Its just hard to understand how the committee can ignore multithreading, while adding things like lambdas and type inferencing.

    3. Re:Nice, but maybe irrelevant. by tibit · · Score: 1

      The loop macro is, in essence, part of the compiler or the standard library. It is code that processes code during compilation. I'm not surprised that it's nontrivial.

      --
      A successful API design takes a mixture of software design and pedagogy.
    4. Re:Nice, but maybe irrelevant. by Anonymous Coward · · Score: 0

      You're thinking about this the wrong way, IMO.
      1) Yes, some territory is "experts-only", and that's ALWAYS going to be the case. Deal. (I don't know any significant real-world software-- or, pretty much anything-- for which this is not true);
      2) For interacting with antique libraries, the point is that you CAN DO IT. It's really difficult to make that safe, you can't modify the old code and there are vast application areas which may be tuned to a very specific purpose. The "fans" are absolutely right. The hardware isn't safe, so when you represent that...
      3) C++ has a major requirement of being (mostly) backward compatible with C. Much of what you are complaining about is a direct result of that-- it's a feature, not a bug. :)

      The world always looks rosy through a tiny picture window. C++ handles what happens when there's no window, and for the most part does so very admirably.

    5. Re:Nice, but maybe irrelevant. by Anonymous Coward · · Score: 0

      The problem isn't that it's notrivial. The problem is that when something goes wrong, the end user has to debug it by interpreting the mysterious error messages that are emitted by whatever part of its implementation finally ended up failing. That wouldn't be the case if it were part of the compiler. The compiler could detect errors in how it was USED and issue succinct error messages about that, rather than exposing how it is IMPLEMENTED.

    6. Re:Nice, but maybe irrelevant. by Anonymous Coward · · Score: 0

      You talks about safety as if it was limited to buffer overflows and diverse memory errors, and as if this things where completely inevitable in C++, and even that they are extremely frequent.
      I know many people who say the same thing, and they are all incompetent in C++ and are barely programmers at the beginning. Oh, yes, they can do some code, but it is crappy or just incorrect at best. They are even worse when it comes to C, since there is no standard containers to baby-sit them when they have to store things.

      Good C++ programming do NOT result in buffer overflows, pointer errors or memory errors. That is not even difficult. You just have to know the basics, and to follow them.
      These are not a language error, but a programmer fault.
      You could say the language does not help the programmer, but that's only partly true. First, if you don't define NDEBUG then there is systematic bound-checking in all standard containers. Second, even in Java, the "safe language", you can do stupid things like memory leaks, null pointer dereferencing, buffer overflow and integer overflow, and Java is not that much developer-friendly when it comes to some of this.

      So, in (probably vain) hope that it settle this down for something like 5 minutes,

      Please, do not confuse your incompetence or ignorance for an hypotetical C++ weakness.

    7. Re:Nice, but maybe irrelevant. by Anonymous Coward · · Score: 0

      I think it is the opinion of some of the brightest programmers that programming should be left only to the brightest. I am sure Linus Torvalds is in this camp. Others believe mere mortals can and should program. Guido von Rossum is in this camp.

      Now, these two camps are really about personal attitudes about exclusivity: If you don't know the roads around here, you probably don't belong here (in this exclusive neighborhood). Whenever I deal with a community, this inclusion/exclusion seem to be one of the factors that bind members to the community. Java and Python programmers seem to be in the inclusion camp--extensive documentation and libraries, clear method and variable names--whereas C/C++/LISP community is in the exclusion camp.

      I will code in whatever language my job requires me. But my personality leans towards inclusion, and I like Java and Python, and not so much C++. Now go mod me down!

    8. Re:Nice, but maybe irrelevant. by Anonymous Coward · · Score: 0

      Some years ago, someone figured out that it was possible to abuse the C++ template system into doing arbitrary computations at compile time.

      Are you thinking of Andrei Alexandrescu and the template metaprogramming stuff he describes in Modern C++ Design? I can't say I've needed most of the techniques, but the simpler ones such as compile-time assertions and policy classes are really handy.

      they could have been including support for multithreading.

      Show me a way C++ can support multithreading without requiring a particular implementation at the ABI level and I'll get on board. For now, though, policy classes work a lot better for me, since I could be using pthreads or GNU pth or eCos or FreeRTOS or whatever Windows uses or whatever else hasn't been written yet, and all I have to do is make sure the associated policy class is up to spec, then feed it to the template and let inlining and the optimizer take care of the rest.

    9. Re:Nice, but maybe irrelevant. by rmstar · · Score: 3, Informative

      The loop macro is, in essence, part of the compiler or the standard library. It is code that processes code during compilation. I'm not surprised that it's nontrivial.

      The problem isn't that it's notrivial. The problem is that when something goes wrong, the end user has to debug it by interpreting the mysterious error messages that are emitted by whatever part of its implementation finally ended up failing. That wouldn't be the case if it were part of the compiler. The compiler could detect errors in how it was USED and issue succinct error messages about that, rather than exposing how it is IMPLEMENTED.

      Lisp programmer here.

      The loop macro actually has access to all the innards of the compiler and gives reasonably useful error messages, at least when compared with standard issue C++ error messages. The loop macro is in fact a lisp program with full access to everything. It can and does produce error messages through the same mechanism than the compiler. C++ templates is a horrendously perverted shadow of what lisp macros are.

      Try Common Lisp some day. It so superior to C++ - it is amazing.

      (...and there goes my karma)

    10. Re:Nice, but maybe irrelevant. by TheRaven64 · · Score: 4, Informative

      While they were sitting around arguing over concepts, they could have been including support for multithreading

      Actually, they did add some support for threading. C++11 has support for a thread-local storage qualifier and a rich set of atomic operations. These are both also in C1x. There is also now a std::thread class, and various synchronisation primitives, and even support for futures / promises.

      Much as I dislike C++, the latest version does have a subset that is much nicer than any subset of previous versions.

      --
      I am TheRaven on Soylent News
    11. Re:Nice, but maybe irrelevant. by Lunix+Nutcase · · Score: 2, Informative

      While they were sitting around arguing over concepts, they could have been including support for multithreading.

      They did include support for that. That's been a well-known piece of the new standard for nearly 2 years now.

    12. Re:Nice, but maybe irrelevant. by jgrahn · · Score: 1

      Some years ago, someone figured out that it was possible to abuse the C++ template system into doing arbitrary computations at compile time. This developed a fan club. That fan club has dominated the C++ standards committee, because nobody else cared. So now we have a standard for C++ which supports template-based programming a little better.

      Current thinking seems to be that,while template programming is too hard for ordinary programmers, the templates will be written by l33t programmers and then be used by the lower classes.

      You're thinking about Template Meta-programming, not the everyday templates I use.

    13. Re:Nice, but maybe irrelevant. by Kevin+Stevens · · Score: 1

      Wow, you are right. I thought that got dropped from the final version of the standard. I haven't seen anyone write about those features in a long time.

    14. Re:Nice, but maybe irrelevant. by rmstar · · Score: 1

      Please, do not confuse your incompetence or ignorance for an hypotetical C++ weakness.

      Well, that's typical sectarian. "If it doesn't work for you, it is you who did something wrong".

      C++ imposes a massive burden on the programmer. You have to be a lot smarter than with other, better programming languages just to get something done reasonably well. There are a million rules with a million exceptions, and things keeps constantly going wrong. Of course, it is your fault every time they go wrong.

      Since I do not program in C++ anymore, that's fine with me. I can live with it being your fault. It is your fault that you cannot see what a bad language C++ actually is.

    15. Re:Nice, but maybe irrelevant. by maxwell+demon · · Score: 1

      I think you hit the problems with templates nicely. While they were sitting around arguing over concepts, they could have been including support for multithreading.

      They have included support for multithreading.

      --
      The Tao of math: The numbers you can count are not the real numbers.
    16. Re:Nice, but maybe irrelevant. by Anonymous Coward · · Score: 0

      With a properly designed language you could write meta-code with exactly the same syntax as normal code. In C++'s case that would mean being able to use method calls, for-loops, object creation, string compares, stl containers and whatnot to perform things like evaluating a compile-time constant to 500 decimals, vectorizing a scalar routine, or converting stuff to run on a gpu.

      It's natural to think code-code as something convoluted and weird if you've only ever seen it done with esoteric declarative kludges.

    17. Re:Nice, but maybe irrelevant. by Anonymous Coward · · Score: 0

      std::thread not good enough for you?

    18. Re:Nice, but maybe irrelevant. by Lunix+Nutcase · · Score: 1

      Well, that's typical sectarian. "If it doesn't work for you, it is you who did something wrong".

      In many cases it is you who is probably doing something wrong.

      C++ imposes a massive burden on the programmer. You have to be a lot smarter than with other, better programming languages just to get something done reasonably well.

      Oh noes! You actually have to be smart to be a C++ programmer. Oh the horror!!! THE HORROR!!!!!!!! Wait, why is that a bad thing? We have enough incompetents writing software as it is. We don't possibly need to lower the bar any further, do we?

    19. Re:Nice, but maybe irrelevant. by Anonymous Coward · · Score: 0

      Yeah, during the '90s there was a worldwide community of academic and corporate C++ hackers loosely clustered around the now-defunct journal "C++ Report", that seemed to enjoy pushing the envelope especially with templates. I think an unexpected feature that template brought to the language was "duck typing polymorphism": the idea that a template could be instantiated against any object that supported all the method names found in the template, as long as the argument and return types were compatible: if the object walks and quacks like a duck, it's a duck. This was a neat way around the "inheritance jail" that C++ and other object-oriented languages had long struggled with, often with clumsy solutions (e.g., every class has to inherit from java.lang.Object).

      Incidentally, it's too bad the full archives of the C++ Report have never been made available AFAIK, although there have been scattered (an unsatisfying) compilations on web sites and in book form ("C++ Gems"). *ALL* of the C++ heavies contributed to journal during its heyday, from Stroustrup on down. By 2002 or 2003 the attention of software developers had turned towards Java, XML, and .NET, so the time for the C++ Report had gone... and I think there were legal skirmishes over the assets of the publisher, SIGS Publications, after it went out of business. But they had a great 10-year run during the '90s.

    20. Re:Nice, but maybe irrelevant. by Barromind · · Score: 1

      But is there support for anything higher-level than locks and atomic variables? (I'm asking -- I don't really know, my latest attempts didn't show anything better than that -- and that was in boost).

      If not, adding multi-threading without proper data protection is just opening a whole new can of bugs. Java has synchronized and Ada tasks and protected objects. IMHO not having the monitor concept built-in into the language is just asking for trouble big time.

      And being a user of boost myself I truly am thankful for its existence and it being half of the new standard, so to speak. It eases the pain of low level programming a lot, but a library can only do that much against bad/lazy practices not discouraged by the language.

    21. Re:Nice, but maybe irrelevant. by Prune · · Score: 1

      Support for multithreading is right there, what are you talking about? std::thread, std::mutex, std::atomic, etc. They're clean and simple, and it was a breeze for me to implement the classes from scratch for my Visual C++ projects (luckily gcc already has those and most other C++0x addtitions). I avoid boost in part exactly because of the issue you mentioned, and in part because of bloat. Using boost is a choice the programmer makes when he should be aware that in general the language standards will not mirror it, despite taking ideas from it--there was never made a promise by the committee to do so!

      --
      "Politicians and diapers must be changed often, and for the same reason."
    22. Re:Nice, but maybe irrelevant. by rmstar · · Score: 1

      Oh noes! You actually have to be smart to be a C++ programmer. Oh the horror!!! THE HORROR!!!!!!!! Wait, why is that a bad thing?

      It becomes wrong the moment that you spend your brain power caring for superfluous bullshit. Well, at least I don't like that. That's why I use languages with GC, parsable syntax, and sound semantics.

      We have enough incompetents writing software as it is. We don't possibly need to lower the bar any further, do we?

      What we definitively have is too many people without any sense of taste or elegance developing software. It's easy to spot them: they love C++.

    23. Re:Nice, but maybe irrelevant. by Anonymous Coward · · Score: 0

      It's nice that they finally got the standard done. But there's so much junk in there. The C++ committee was dominated by people who wanted to do cool things with templates.

      How do you figure? AFAIK, the only template-related addition has been in this new standard. Namely, variadic templates.

      Some years ago, someone figured out that it was possible to abuse the C++ template system into doing arbitrary computations at compile time. This developed a fan club. That fan club has dominated the C++ standards committee, because nobody else cared. So now we have a standard for C++ which supports template-based programming a little better.

      And you're still stuck up on it? That "argument against C++" is so old, not to mention weak, I'm surprised anyone still brings it up.

    24. Re:Nice, but maybe irrelevant. by StripedCow · · Score: 1

      So now we have a standard for C++ which supports template-based programming a little better.

      It's sad that we have to use different types of syntactical constructs for this meta type of programming. The whole template-based approach is turing-complete, but this is only a theoretical trait; in practice only the most stubborn programmers can do template meta programming, and they even don't understand their own code after a while (I'm speaking from personal experience).

      It would be so much nicer if we could just do meta-programming in the language itself, so to speak.

      --
      If Pandora's box is destined to be opened, *I* want to be the one to open it.
    25. Re:Nice, but maybe irrelevant. by Anonymous Coward · · Score: 0

      Unlike D, where templates are easy and non-orthogonal, but the language isn't fully implemented.

      http://d-programming-language.org/

    26. Re:Nice, but maybe irrelevant. by agrif · · Score: 1

      Arbitrary computations at compile time are not necessarily a bad thing. LISP had the advantage that regular code and data were notated and stored the same way, so writing macros to shovel code around was no harder than writing functions to shovel data around. Importantly, the language for the macros was the same as the language itself. The loop macro link you provided is a bad example; overall, LISP did macros right.

      C++ templates are a byzantine language that shares nothing at all in common with C++ itself, which is fine if you're not trying to build a turing machine out of them. I want a C-based language with LISP-like macros so bad, but template metaprogramming has always seemed like an abuse to me. Code that convoluted could not have been intended.

    27. Re:Nice, but maybe irrelevant. by Anonymous Coward · · Score: 0

      Why do people continue to miss the fact that C++ has containers and smart pointers, and now thread safe smart pointers specifically to deal with any memory issue?

      There are tons of "hiding with memory safety" features even in the original C++98, and then we had the magnificent Boost which gave even more memory safety. Anyone with basic knowledge of std::vectors can avoid all memory issues related to buffer overflow attacks.

      Stop spreading your ignorance as truth.

    28. Re:Nice, but maybe irrelevant. by Anonymous Coward · · Score: 0

      Try Common Lisp some day. It so superior to C++ - it is amazing.

      I tried it and wanted to like it, but couldn't get past the fundamental design problem that everything is treated as a saved REPL session, so if you want to distribute a compiled binary, it ends up being several hundred megabytes and including the complete compiler and standard library.

      Apparently there are commercial versions that can trim that down to just what your program actually uses, but none of the free ones could. And that's kind of a showstopper if you were planning to use CL for anything other than strictly personal use.

      The language itself is not bad. It's just that when I try out a new language, I want a language, not a complete separate operating system.

    29. Re:Nice, but maybe irrelevant. by Anonymous Coward · · Score: 0

      It's nice that they finally got the standard done. But there's so much junk in there. The C++ committee was dominated by people who wanted to do cool things with templates.

      Cool things with templates? You mean like object code optimization and executables running faster because what can be done at compile time doesn't consume CPU cycles afterwards?

    30. Re:Nice, but maybe irrelevant. by real-modo · · Score: 1

      Sports analogy: programming in C++ forces you to pay attention to your breathing. A marathoner might want this; a volleyball player, not so much.

    31. Re:Nice, but maybe irrelevant. by chthon · · Score: 1

      Possible in D. D should be the successor of C++, but people should also learn Scheme and Common Lisp, because C++ is jus becoming, featurewise, just an ugly shadow of them.

    32. Re:Nice, but maybe irrelevant. by lennier · · Score: 1

      It would be so much nicer if we could just do meta-programming in the language itself, so to speak.

      Yes, it's a pity that the language invented in the 1950s to do just this, and which gave us the IF-THEN statement, garbage collection and object-oriented programming as almost casually discarded spinoffs, has managed to wall itself off from the rest of the programming community and stagnated.

      I sometimes wonder what would have happened if someone had ported a Tiny LISP, rather than Tiny BASIC, to the Altair 8800 in 1975.

      --
      You are not a brain: http://books.google.com/books?id=2oV61CeDx-YC
    33. Re:Nice, but maybe irrelevant. by js_sebastian · · Score: 1

      It's nice that they finally got the standard done. But there's so much junk in there. The C++ committee was dominated by people who wanted to do cool things with templates.

      Some years ago, someone figured out that it was possible to abuse the C++ template system into doing arbitrary computations at compile time. This developed a fan club. That fan club has dominated the C++ standards committee, because nobody else cared. So now we have a standard for C++ which supports template-based programming a little better.

      Not really. The standard provides improved support for generic programming: things like move contructors which, once in use by the STL, will make all your code a little faster, things like auto typing that make using STL and other templated libraries easier, things like lambdas that make using functional programming with STL algorithms a little easier etc. Generic programming is not template meta-programming, and it is one of the great things about C++ and it's libraries, as I thinkt think any serious C++ user will agree.

      And the parts of the new standard that are likely to have the most impact have nothing to do with templates: like the fact it finally provides a standard way of doing concurrency.

      Current thinking seems to be that, while template programming is too hard for ordinary programmers, the templates will be written by l33t programmers and then be used by the lower classes. Unfortunately, if anything goes wrong, the end user has to look at the innards of the template to find the problem.

      This is something that the new "concepts" are supposed to fix (by providing more informative errors that do not involve template innards, at the price of a little extra work for the library developer). Unfortunately concepts did not make it into this standard. I agree that full-fledged template-meta-programming is a pain to use, but I do not think any of the STL libraries go that far... you have to look around in boost to find extreme implementations of that concept, like boost::matrix, which I would not recommend to the faint of heart.

      Note what isn't in the new C++. There's no more memory safety than in the old one. (Fans will say that it's safer if you only use the new features. Now try to call some library that doesn't use them.) So the buffer overflow attacks and crashes will continue.

      C++ is the only language to offer hiding without memory safety. Hard-compiled languages from Pascal through Go have hiding with safety, as do all the major scripting languages. C has neither hiding nor safety; the pointer manipulations are right there in the source. There have been safe, hard-compiled languages without garbage collection, most notably Ada and the Modula family. Safety and speed are not incompatible.

      If by "safety" you just mean array bounds checks, you can enable bound checks for vector in C++ with a compile-time switch, or implement your own vector subclass that does checks. This may have some performance impact for certain workloads. But that's not the same as real memory safety. I don't think anyone has yet solved the problem of designing a memory safe language without garbage collection. Oh, and according to this benchmark https://days2011.scala-lang.org/sites/days2011/files/ws3-1-Hundt.pdf, Go is about as slow as Java, and is 3x slower than C++.

    34. Re:Nice, but maybe irrelevant. by Kevin+Stevens · · Score: 1

      Yeah, there should be a -1 moron mod. I thought that got pushed out.

    35. Re:Nice, but maybe irrelevant. by Anonymous Coward · · Score: 0

      Trying do dis C++ doesn't work when you mention pain-in-the-ass worthless languages such as Ada, Modula, and -gasp- LISP. You're just painting yourself as a programming theorist and not somebody actually doing any heavy lifting getting stuff done.

      It's like telling a strip mining crew that dynamite sucks and that a comb is much better.

    36. Re:Nice, but maybe irrelevant. by badkarmadayaccount · · Score: 1

      You want JS or a dialect of it. Get a good runtime though.

      --
      I know tobacco is bad for you, so I smoke weed with crack.
    37. Re:Nice, but maybe irrelevant. by Anonymous Coward · · Score: 0

      If the volleyball player does it in the zen way, or wants to stay on top of his game he might want to pay attention to his breathing as well.

    38. Re:Nice, but maybe irrelevant. by Anonymous Coward · · Score: 0

      English imposes a massive burden on the writer. You have to be a lot smarter than with other, better human languages just to get something done reasonably well. There are a million rules with a million exceptions, and things keeps constantly going wrong. Of course, it is your fault every time they go wrong.

      An analogy for you. ;) To learn a language it has to be used and sometimes assumptions collected from other languages set aside, even if the syntax looks familiar. This is particularly so with people moving between Java and C++.

  18. 8 years! by aglider · · Score: 1

    It took that long for a standard update.

    Having a nee standard every few years is not good, that's clear.
    But spending 8 years to refine/define one sounds quite a lot in the 21st century.

    --
    Sent as ripples into the electromagnetic field. No single photon has been harmed in the process.
  19. Re:C++0xB by NoNonAlphaCharsHere · · Score: 1

    Sadly no one thought to throw an exception when it did.

  20. At least it's in no trouble of dying... by Talonius · · Score: 0

    ...unlike C# which Microsoft seems to enjoy having confusion surround (see the HTML/JavaScript fiasco) or Java, which Oracle seems intent on bringing confusion, branding, and licensing to, C++ has managed to evolve for how many years now? Under a committee of people no less?

    Say what you will but I've recently decided to go back to my roots and work in C and C++ just for that reason -- there's never a loud outcry that the languages will die a horrible death or go anywhere. In a world of uncertainties I'm tired of having to wonder what language I'll need to master next.

    --
    My reality check bounced.
    1. Re:At least it's in no trouble of dying... by Gadget_Guy · · Score: 1

      ...unlike C# which Microsoft seems to enjoy having confusion surround (see the HTML/JavaScript fiasco)

      It is not confusing. Microsoft used HTML/Javascript for Active Desktop. They used HTML/Javascript for Windows Explorer folder views. They used HTML/Javascript for Windows Sidebar. And they will use HTML/Javascript for the tile interface of Windows 8. It doesn't mean that .NET will disappear, just like .NET did not spell the demised of the standard Windows API.

      or Java, which Oracle seems intent on bringing confusion, branding, and licensing to

      It has always had branding and licensing, long before Oracle came on the scene. Look at how they went after Microsoft for license and trademark violations.

      C++ has managed to evolve for how many years now?

      But have they managed to actually implement the features that people want? I have just been reading up on the changes to this new version, and a lot of it seems to be fixing things problems that only exist because of stuff ups in the last version. Java and .NET offer much more than C++, and do it with cleaner code. Sure operator overloading might make some mathematical classes cleaner in C++, but the horrible template interface makes your code appear like it being seen through a haze of line noise.

    2. Re:At least it's in no trouble of dying... by mangu · · Score: 1

      Say what you will but I've recently decided to go back to my roots and work in C and C++ just for that reason -- there's never a loud outcry that the languages will die a horrible death or go anywhere.

      Amen, brother! I've just presented the same argument here. After Python 3 came out, for me it's just C or C++ for programs that need to last for an indeterminate time.

    3. Re:At least it's in no trouble of dying... by PickyH3D · · Score: 1

      At least it's in no trouble of dying unlike C# which Microsoft seems to enjoy having confusion surround (see the HTML/JavaScript fiasco)

      Seriously? People are still confused about that?

      They showed off their new tile interface for Windows 8 and Microsoft did not say anything about .NET _or_ C++. Clearly, this means that .NET is being kicked to the curb.

      Sure, their bet in the mobile space depends on .NET. Their browser extension, which recently just got a major revision depends on .NET. And they are rumored to be adding .NET to the Xbox by the way of Silverlight, and they already use it exclusively with XNA on the Xbox.

      Top it off with the fact that Microsoft is moving to a new architecture and what makes sense? Keeping their MSIL-based binaries going. After all, the C++ binaries--without some sort of "universal" extension like Mac OS X had between PowerPC and x86--won't work. What will? .NET.

      ...or Java, which Oracle seems intent on bringing confusion, branding, and licensing to...

      Realistically, I do not even think Java is really in a confused state. The only confusion is whether or not someone can roll their own JVM, and whether they will play ball with Apache on the committee level.

      I am all for C++, and if anything, I am more shocked that C++ has been able to pick up features before Java. C++ beat Java to lambda expressions (coming in its own form in Java in December 2012--Java 8) and automatic type deduction (Java's approach realized in Java 7 late last month is to enable programmers to avoid typing in the generic arguments on the right hand side of the expression: List<String> list = new ArrayList<>();).

    4. Re:At least it's in no trouble of dying... by Anonymous Coward · · Score: 0

      I've noticed that if you write your code like a poet, an author, as opposed to time-crunching-programmer, it comes out looking fine even with excessive use of templates. The only issue is that you must take some serious time to keep your code clean (and not be a psycho).

      Honestly, forgive me for the vulgarity - but if you take a pile of shit and smear it on the wall - who's to blame for the terrible stink? The shit, yourself, or the wall?

      You may never account for what other programmers are going to do, but the extremist that abuse the shit out of templates (and many, many other concepts) are the ones to blame, not the committee. It's almost like a cult of monkeys smearing shit on the walls, and we keep blaming the shit instead of the monkeys.

      At this point it is too complex to grasp as a single individual, but can still be wielded properly if the programmer has any sense in him (or her, however unlikely).

    5. Re:At least it's in no trouble of dying... by flimflammer · · Score: 1

      C# isn't going anywhere. Their lack of support for this newfangled interface in Windows 8 does not mean they're dropping it.

    6. Re:At least it's in no trouble of dying... by gbjbaanb · · Score: 1

      however, they did say plenty about 'Going Native' where the focus is back on native code. The story behind the story is that the 2 teams at MS have been playing politics for years, each one refusing to work with the other, and to date the Developer Division team has been pushing for their nice new languages and frameworks that the Windows Div team didn't like (apparently they tried it and it didn't work for them), now things are getting consolidated at MS they've been told to play nice and the Windows team has basically won (as they're a bit more important), so we'll be getting tools that they want rather than the tools the developer division wants to give us.

      I'm sure .NET will not be dead, but you will see some sort of XAML-based GUIs available in native code, and you will see HTML5+JS as the primary GUI framework for Windows 8/Windows Phone.

    7. Re:At least it's in no trouble of dying... by PickyH3D · · Score: 1

      I am not sure that having a XAML front-end for C++ GUIs is necessarily a bad thing, or even a negative for .NET. It certainly takes a feather out of .NET's hat, but it actually brings the two closer together. Suddenly, they can share their knowledge and experience, and C++ gets a much better UI framework than MVC.

      Similarly, and just as supposedly, Microsoft is finally adding .NET APIs alongside the native APIs. This will make .NET a first class citizen and hopefully put to bed these rumors.

      I also do not think that Microsoft will do anything except make HTML5+JS a first class citizen as well. I doubt that they really want to try to beat out both C++ and .NET with HTML5+JS. I am sure that they will add it as a new option, but I both doubt and hope that they do not expect a shift to it. Although, I do wonder how the hooks would work and in terms of attractiveness and customizability, it certainly would be pretty high up there (when done right).

    8. Re:At least it's in no trouble of dying... by gbjbaanb · · Score: 1

      XAML in C++ is something they should have done from the start, but then they should have gotten a much better way to bind a variable to an element - how many lines of code did MFC need to do this? 2, and that included the line for the variable definition. C# requires a whole object plus properties :)

      The thing that struck me is that there isn't much different between XAML+c# and HTML+js. Both are xml-based declarative markups that you associate code with. The biggest difference is that you associate code in script form with HTML so you don't need to go compiling anything. This probably makes it a better choice and ultimately means that GUI development will be better then the old XAML assemblies we've had to work with before. I imagine MS will add some custom extensions to HTML before long, as is their way.

      Anyway, doesn't matter what we think, what works for the WinPhone is what we'll be getting whether we like it or not :(

  21. I can't wait... by Anonymous Coward · · Score: 0

    ...for the nect version called C++0xck!!!!

  22. Nested Functions by Anonymous Coward · · Score: 0

    Anyone know if they added nested functions? It's the thing I miss the most when I'm using C or C++ on multiple platforms.

    1. Re:Nested Functions by rubycodez · · Score: 1

      yeah, they have that, it's called "pascal"

    2. Re:Nested Functions by Anonymous Coward · · Score: 0

      Why would they do that, when you easily work around the issue by using lambda functions:

      int fun(int a, int b) {
          auto nested = [&](int x){
              int y = b*x;
              b += x;
              return y;
          };
          return nested(a)+nested(a+1);
      }

    3. Re:Nested Functions by Daniel+Phillips · · Score: 1

      Nested functions are now supported very nicely in gcc, but not g++ for some unfathomable reason.

      --
      Have you got your LWN subscription yet?
  23. Hell continues to get colder by Anonymous Coward · · Score: 5, Funny

    First DNF, then a HURD kernel, now C++0x... Remind me to send some parkas to hell.

    1. Re:Hell continues to get colder by Anonymous Coward · · Score: 0

      Hey, don't forget to send some parkas to hell.

    2. Re:Hell continues to get colder by HyperQuantum · · Score: 1

      You forgot to mention Wine 1.0.

      --
      I am not really here right now.
  24. Super work!!! by Anonymous Coward · · Score: 0

    Great job, folks!!!!! :-)

    Although everyone didn't get what they wanted, overall the new standard is very, very impressive! The new features open up
    whole ecosystems of ideas and will allow for amazing engineering of elegant next-generation software in the real world!

    1. Re:Super work!!! by Toonol · · Score: 1

      Am I bitter and jaded? I can't help but view those comment as biting sarcasm. Is it possible the poster is simply being nice and optimistic?

  25. Nice try, sonny. by Anonymous Coward · · Score: 0

    1) Multiple inheritance "it's a floor wax! it's a desert topping! it's both!"

    BFD. All it does is obfuscate code. There are so many times when an inherited class doesn't do what it should or acts wacky because of something in the inheritance chain.

    2) Operator overloading: because TimeCard + MoveTicket + WorkOrder is so much more readable

    Really? Ever come across something like this:
    'TimeCard >> MoveTicket' or 'TimeCard | MoveTicket' or some weird thing that does nothing like what you'd expect?
    I've seen really crazy operator overloading in my time and many times completely unnecessary and hides so much functionality that without stepping into source, you'd never figure it out.

    3) Virtual destructors: because the concept is so easy to explain.

    pffft.

    Errrr. Give me a minute. I'm sure I'll think of something.

    All those reasons are fluff. None of them are really that compelling.

    Now, if you mentioned something that actually makes C++ shine, like the STL where it saves work with a tried and true implementation, then you may have had something. That and and GUI frameworks are the only things I'd miss if I just programmed Standard C.

    Back when C++ first came out to the general public (1990 IIRC), it was nice. It just enough nice features that increased programmer productivity - that's the only benefit of OOP, btw. And the sucky part is with all these features, programmer want to use them. One of my biggest pet peeves is programmers who use a language feature because it's there; not because it adds to ease of development - like creating a template for a class that will never, ever use anything other than a LONG. Why create a template with all of that compiler baggage and subsequent bloat?!?

    I blame OOP as one of the reasons for the increasing bloat of software.

    1. Re:Nice try, sonny. by Anonymous Coward · · Score: 1

      Remember to test your sarcasm detector twice a year and replace the batteries regularly.

    2. Re:Nice try, sonny. by Anonymous Coward · · Score: 0

      Why do people go to great lengths to describe things stupid PROGRAMMERS do and then blame their tools? Something about a carpenter and his tools comes to mind.

      News flash, I've seen horrifically stupid, brain damaging code, in just about all languages and I can tell you, inversely proportional to the complexity of the language is the number of chest thumping, dip shit morons. Basically, a higher barrier for entry tends to weed out a lot of dumb fucking programmers. By far, I've seen more horrifically stupid things done in languages like VB and Java than I have ever seen in C++. Though I must admit, I have seen some C code (actually nothing but macros), which if there was a God in heaven, would have instantly struck down the programmer - which would have been right as he was a complete fucking idiot.

    3. Re:Nice try, sonny. by lowlevelio · · Score: 1

      > I blame OOP as one of the reasons for the increasing bloat of software. Not in the same ball park as BASIC, java & .net.

  26. nyah! by Thud457 · · Score: 1

    You probably posted that comment using software written in C++.

    And you probably posted the comment using software written in C.

    --

    the preceding comment is my own and in no way reflects the opinion of the Joint Chiefs of Staff

    1. Re:nyah! by SnarfQuest · · Score: 0

      You probably posted that comment using software written in C++.

      And you probably posted the comment using software written in C.

      No, I used something I hacked up using a version of perl written in java.

      --
      Who would win this election: Andrew Weiner vs Andrew Weiner's weiner.
    2. Re:nyah! by bonch · · Score: 1

      You probably posted that comment using software written in C++.

      And you probably posted the comment using software written in C.

      No, WebKit is written in C++ like the rest of Chrome.

    3. Re:nyah! by Anonymous Coward · · Score: 0

      ...Running on an OS written in C and a little assembly.

    4. Re:nyah! by oursland · · Score: 1

      Like Inception, we must go DEEPER!

      I bet your OS is written in C at some level. But, nice try.

  27. everything in moderation, of course by Thud457 · · Score: 1

    Necessity may be the mother of invention, but laziness is the lil' bastard's father.

    --

    the preceding comment is my own and in no way reflects the opinion of the Joint Chiefs of Staff

  28. Different purposes by Anonymous Coward · · Score: 0

    Let's not confuse interpretted and compiled languages. They are for different things and both have their own merits.
    Also, lets get this garbage collection talk out of here, if you call new, call delete. It's simple. Get used to it.

    1. Re:Different purposes by PickyH3D · · Score: 1

      Given the new pointer types: unique_ptr, shared_ptr, and weak_ptr, I'd say that the spec actually disagrees with you. You practically never actually need to call delete if you use them.

      It even provides the basis for implementing a garbage collector within C++ (ABI), although one is not required to meet the spec.

      It's quite fair to compare and contrast C#, Java, and C++ as long as you realize they each offer benefits, with trade offs. Not to mention, Java nor C# are truly interpreted. They are both compiled locally to native code on the local machine, which can potentially lead to better optimizations than the else-where compiled C++ binaries. In practice, the C++ will still be faster, but lets not get ahead of ourselves.

    2. Re:Different purposes by Lunix+Nutcase · · Score: 1

      They are both compiled locally to native code on the local machine, which can potentially lead to better optimizations than the else-where compiled C++ binaries. In practice, the C++ will still be faster, but lets not get ahead of ourselves.

      And if you want the benefit of optimization based on runtime data such as in .NET or Java, just use Profile-guided optimization which has been available in MSVC++, Intel's C++ compiler and GCC for years now. You get all the benefits of a runtime optimization of a JIT-compiled language without the overhead combined with much more extensive compile-time optimization that you don't usually get with say Java or a .NET language.

    3. Re:Different purposes by Anonymous Coward · · Score: 0

      Except when you don't, of course.

      There's a slew of optimizations that cannot be done by PGO. One notable technique amongst these is run-time inlining (esp. of virutal method calls). Another is on-line memory compaction (increasing locality).

  29. You lose the Lisp war! by CountBrass · · Score: 1

    (+ x y z) is perfectly valid in Lisp

    So (+ A (* B C) ( * A D))

    is better style.

    --
    Bad analogies are like waxing a monkey with a rainbow.
  30. Mandatory Lisp observation... by CountBrass · · Score: 1

    So C++ takes another step closer to Lisp (lambda functions) whilst completely missing the most important part (closures and higher order programming).

    I look forward to C++ 2031 when they implement garbage collection but still require you to place and remove locks on memory ;)

    *Ducks and runs for cover*

    --
    Bad analogies are like waxing a monkey with a rainbow.
    1. Re:Mandatory Lisp observation... by Lunix+Nutcase · · Score: 1

      *facepalm* C++0x has closures. For example, here is an article talking about them in C++0x. Hell the article is 3 years old at this point.

    2. Re:Mandatory Lisp observation... by EsbenMoseHansen · · Score: 1

      So C++ takes another step closer to Lisp (lambda functions) whilst completely missing the most important part (closures and higher order programming).

      I look forward to C++ 2031 when they implement garbage collection but still require you to place and remove locks on memory ;)

      *Ducks and runs for cover*

      Higher order programming? Lol. Anyway, the lambda functions can be closures, if you want.

      Garbage collection is not something I miss, but if it is included, I hope it is opt-in, to avoid the resource leaks and memory wastage so rampant in the garbage-collected world.

      --
      Religion is regarded by the common people as true, by the wise as false, and by rulers as useful.
    3. Re:Mandatory Lisp observation... by Anonymous Coward · · Score: 0

      Umm, higher order programming is there to. *sigh*

      #include <functional>
       
      bool true_( ) { return true; }
      bool false_( ) { return false; }
      bool thruth( bool b ) { return b; }
       
      std::function< bool ( void ) > f( int i ) {
              if ( i == 0 ) return true_;
              else return false_;
      }
       
      void CountBrass_is_a_lisp_junky( ) {
       
          auto f1 = f( 0 );
          auto f2 = f( 1 );
          auto f3 = std::bind( thruth, true );
          auto f4 = std::bind( thruth, false );
       
          bool a = f1( );
          bool b = f2( );
          bool c = f3( );
          bool d = f4( );
       
      }

  31. Submitter FAIL by kipsate · · Score: 1

    type inference which should save quite a few people from RSI
    Because surely, the hard work of writing code is in all that typing.

    and make refactoring code a bit less obnoxious
    Because yeah, refactoring is all about continuously retyping your variables.

    I haven't heavily used C++ in years
    ... and never coded anything beyond a two-dice simulation.

    --
    My karma ran over your dogma
    1. Re:Submitter FAIL by Lunix+Nutcase · · Score: 1

      Because surely, the hard work of writing code is in all that typing.

      No, but when you use a lot of for loops with iterators being able to type, for example, auto i = ivec.begin(); instead of vector::iterator i = ivec.begin(); makes things a lot less tedious and, for me, makes things more readable with less noise obscuring the intent of the code.

    2. Re:Submitter FAIL by Lunix+Nutcase · · Score: 1

      That was meant to be vector<int>::iterator. And obviously in my example this isn't as bad, but say you are dealing with a more complex container declaration and the type of the iterator can expand out like crazy.

    3. Re:Submitter FAIL by Anonymous Coward · · Score: 0

      That was meant to be vector<int>::iterator. And obviously in my example this isn't as bad, but say you are dealing with a more complex container declaration and the type of the iterator can expand out like crazy.

      Which is why prudent programmers typedef their container declarations. I assume one would still have to declare the iterator type to get a const iterator or can you use "const auto"? So "SomeCont::const_iterator it = ivec.begin();" becomes "const auto it = ivec.begin();"? Doesn't look like much of an advantage to me.

  32. What is with you morons? by Anonymous Coward · · Score: 0

    It's as if you're basing your comments on the GC technology of the early 90's...

    Besides, RAII doesn't work unless you have lifetimes that are scoped in some reasonably predicable way. Reference counting doesn't work if you have cycles. Yeah, sure, you can try to use weak pointers to break the cycles, but then you end up introducing additional logic/complexity by having to react to pointers disappearing on you.

    There are also various dynamic programming algorithms which simply have runtime memory behavior which is too complex for manual memory management.

    1. Re:What is with you morons? by Lunix+Nutcase · · Score: 1

      There are also various dynamic programming algorithms which simply have runtime memory behavior which is too complex for manual memory management.

      Then use the built-in dynamic memory management support of the language.

  33. Re:C++0xB by maxwell+demon · · Score: 1

    That's because in C++, overflow is simply undefined behaviour.

    --
    The Tao of math: The numbers you can count are not the real numbers.
  34. hello modular programming? by luis_a_espinal · · Score: 1

    Not really. The main advantage of objects is the loose coupling.

    I always thought that well-executed structured and modular programming exhibited loose coupling all along, and that poorly executed OO programming would not (and currently does not just by taking a whiff at the majority of the code base out there written in a OOP language.)

    But I guess I was dreaming or I was smoking some serious weed, and the reality is that objects are a necessary condition for loose coupling. Silly me.

  35. Uhm no. by Anonymous Coward · · Score: 0

    *facepalm* Only if you, as the article you link to does, redefine the term closure.

    Show me the equivalent to:

    (let ((foo 1))
        (lambda ((+ foo bar))))

    And

    (let ((foo 1)
                  (bar 2))
        (lambda ((+ foo bar))))

    I let you infer the point I'm making ;)

    1. Re:Uhm no. by Lunix+Nutcase · · Score: 1

      a closure (also lexical closure, function closure or function value) is a function together with a referencing environment for the nonlocal names (free variables) of that function.

      C++0x has exactly that with lambda functions. No one is redefining anything. For example:

      [](int x, int y) { return x + y; }

      This is a perfectly valid example of a closure that fits the accepted definition of what a closure is.

    2. Re:Uhm no. by Anonymous Coward · · Score: 0


      int foo = 1;
      auto c = [&](int bar){ return foo+bar; }
      use_closure(c);

  36. But... I like C++0x! by Anonymous Coward · · Score: 0

    I feel the urge to post a comment, because just too many are criticizing C++0x, where I really like it!

    For a couple of months I am following the GCC updates for an increasing portion of C++0x features and familiarizing myself with the implemented ones.

    Stroustrup mentioned that C++0x feels like a new language, and I think he's right: the combination of lambda expressions and automatic type deduction (using auto) makes working with data remarkably fluid, without much work (that is: without templating/typedef-ing each data type).

    And the new algorithms (did I miss std::copy_if!) and the new data types (e.g. std::thread) are great to have in an STL toolbox, ditching my own handcrafted and now obsolete code. Sure, most of them was/is in Boost, but it feels good that these are standarized to C++ its high standards.

    I look forward to the upcoming books of the experts (Stroustrup, Sutter, Meyers, Alexandrescu, ...) for increasing my, yes really, increased productivity even more!

  37. Oh dear. by CountBrass · · Score: 1

    *facepalm* indeed.

    The argument the article makes is the same as a C programmer claiming he can implement classes and instances in C using structs and pointers.

    True, of course, but a real pain in the arse.

    A class instance can be used to simulate *some* of the most basic features of a closure but none of the really useful stuff- and it's a pain.

    If C++ supported closures you could replace the ~10 lines of C++ code in the example you linked to with 3- and you wouldn't need to create the clutter of a new class to just to create a closure.

    --
    Bad analogies are like waxing a monkey with a rainbow.
    1. Re:Oh dear. by Lunix+Nutcase · · Score: 1

      If C++ supported closures you could replace the ~10 lines of C++ code in the example you linked to with 3- and you wouldn't need to create the clutter of a new class to just to create a closure.

      Who says you have to create a class to create a closure? Where did you get that nonsense from? I think you misunderstood his example. From the article:

      [&](const employee& emp) (emp.salary() >= minimum_salary && emp.salary()

      This is a lambda expression which by their very nature are closures since it creates a lexical scope that results in a closed expression.

    2. Re:Oh dear. by FrangoAssado · · Score: 1

      When people say that a language has closures, they mean that a closure is a first class object: in particular, you should be able to return it from the function/method where it was created.

      You could argue that being able to return a lambda would be very un-C++-like, and I tend to agree -- it feels like returning a pointer to a stack variable (in fact, it would be something close to that, if the lambda captures a stack variable). You could argue that returning a lambda would be mostly useless in C++ (I'd disagree, but whatever). You could even argue about the semantics of the name "closure", and whether it should imply being a first class object.

      But don't fool yourself into thinking that C++'s lambda is equivalent to what's called a "closure" in other languages; it's not.

    3. Re:Oh dear. by David+Greene · · Score: 1

      you should be able to return it from the function/method where it was created.

      Um...you can. Thus the whole bit about capture lists. std::function is your friend.

      --

    4. Re:Oh dear. by FrangoAssado · · Score: 1

      Um...you can. Thus the whole bit about capture lists. std::function is your friend.

      No, you can't -- not when it would matter for C++ lambdas to be equivalent to other language's closures. The "while bit about capture lists" is there, in part, to specify exactly when you can.

      From the standard, pages 89-90:

      If one or more names in the effective capture set are preceded by &, the effect of invoking a closure object or a copy after the innermost block scope of the context of the lambda expression has been exited is undefined.

      So, when the lambda actually "closes over" a variable (not just capturing its value), you can't use it outside the block where it was defined. That's unsurprising, since it would mean keeping the stack alive or "lifting" the variable from the stack into the heap, which would open a whole new can of worms.

    5. Re:Oh dear. by David+Greene · · Score: 1

      So, when the lambda actually "closes over" a variable (not just capturing its value), you can't use it outside the block where it was defined. That's unsurprising, since it would mean keeping the stack alive or "lifting" the variable from the stack into the heap, which would open a whole new can of worms.

      What does your favorite language do in this case? Does its memory model have a local stack concept at all? I guess I'm not sure how any other language with a local stack model would implement this without promoting the variable to long-lived storage. Is this really a case of C++ not providing the equivalent to some other language or is it instead a case of extra C++ functionality that doesn't map onto another language's memory model well. In C++11 one can certainly create closures over objects that are global, on the heap, etc. and pass them around at will.

      --

    6. Re:Oh dear. by FrangoAssado · · Score: 1

      What does your favorite language do in this case? Does its memory model have a local stack concept at all? I guess I'm not sure how any other language with a local stack model would implement this without promoting the variable to long-lived storage.

      That depends heavily on the language and possibly on how you choose to implement it.

      Lua 5, for example, "lifts" the variable from the stack to the heap when a closure referencing it survives the block where it was created (it calls the variables that are closed over "upvalues"). It's not problematic as C++ because you can't get the address of a variable (so it doesn't matter when the address changes). Scheme and Lisp have many different implementations that vary wildly: from the "lifting" that Lua does to letting the variable live on the stack frame where it was created, and garbage collect stack frames the same way heap is garbage collected (see here). I'm not familiar with other language and/or implementation strategies, but I'm sure there are many more ways to do it, and many variations over what I just mentioned.

      Is this really a case of C++ not providing the equivalent to some other language or is it instead a case of extra C++ functionality that doesn't map onto another language's memory model well. In C++11 one can certainly create closures over objects that are global, on the heap, etc. and pass them around at will.

      Well, even ignoring the fact that you can't really close over variables that are on the stack (because you can "close over" stuff on the heap by making the lambda reference the pointer by value -- I assume that this is what you mean by "create closures over objects that are on the heap"), as far as I can tell closures lose a lot of usefulness when you don't have garbage collection. Just as a quick example (I'm sure this isn't the best example, but it's all I can think of right now), closures are great for setting up ad-hock event handling, with some objects shared by a few event handlers belonging to a window. That would be very awkward in C++, because you'd have to make sure someone is responsible for deleting the objects when the event handlers disappear (one would probably end up having to subclass the window and add the objects to its list of members, and then you'd have to make sure the right original window's methods are virtual, etc.).

    7. Re:Oh dear. by David+Greene · · Score: 1

      Just as a quick example (I'm sure this isn't the best example, but it's all I can think of right now), closures are great for setting up ad-hock event handling

      That is true.

      with some objects shared by a few event handlers belonging to a window. That would be very awkward in C++, because you'd have to make sure someone is responsible for deleting the objects when the event handlers disappear

      People have been doing this in C++ for a long time, albeit without the nice syntactic sugar. Boost.signals is but one example. C++ lambdas make common, yet often wordy, code easier to read and maintain. The core concept of an invokable object with state has been there since the beginning via overloading operator().

      --

  38. Counter point. by CountBrass · · Score: 1

    If I add a new public function to a class why should have to re-compile all the old code that doesn't use that function?

    Other languages can manage not to require that so why can't C++?

    --
    Bad analogies are like waxing a monkey with a rainbow.
    1. Re:Counter point. by CountBrass · · Score: 1

      Ditto, and more importantly, if I add a private data member why should I have to re-compile anything other than the class?

      Private members are not even a part of the public interface!

      --
      Bad analogies are like waxing a monkey with a rainbow.
    2. Re:Counter point. by buchner.johannes · · Score: 1

      Is that you need to recompile the fault of the language or the fault of make?

      --
      NB: The message above might reflect my opinion right now, but not necessarily tomorrow or next year.
    3. Re:Counter point. by NoOneInParticular · · Score: 1

      Private members are part of the public interface in C++. Friends can see your privates.

    4. Re:Counter point. by Javagator · · Score: 1
      If I add a new public function to a class why should have to re-compile all the old code that doesn't use that function?

      C++ requires that the size and layout of an object in memory (its vtable) be known at compile time for efficiency. Otherwise, there would be another level of indirection requiring a second memory read. From what i have read, Stroustrup was very aware of the concern for efficiency among C programmers and wanted C++ to be on a performance level with C.

    5. Re:Counter point. by Zan+Lynx · · Score: 1

      Private members are a part of the class's public interface in C++ because they affect the size of the object, and the object's size is needed by all kinds of things.

      If you want to decouple the private members from the size of the class, use a pImpl pointer (make it a fancy smart pointer type) to a class or struct defined in the .cpp file. Then put all of your private data into that structure.

    6. Re:Counter point. by LizardKing · · Score: 1

      The fault of the language. Private members aren't really private in C++ (thanks to the fuckwittery of "friend" classes), and in practice may prevent linking from working for previously compiled code. I'm not sure whether the previous standards were supposed to preclude that behaviour, and if not whether the new standard with a mandatory memory model does, but I have been bitten by it. Inversely, removing a private member or otherwise changing the private implementation of a C++ class may require a full recompile of the entire code base - again because of the potential for friend classes accessing that supposedly encapsulated implementation.

    7. Re:Counter point. by LizardKing · · Score: 1

      ... new standard with a mandatory memory model ...

      Reading up on the new memory model, it's not to do with the memory representation of an object, so the crappy way C++ mixes the declaration and implementation of classes still sucks.

  39. Now, if we can just get Perl 6... by gregor-e · · Score: 1

    After all, C++0x has only taken, what, 4 years? Perl 6 has been brewing since July, 2000. (Maybe by Christmas?)

    1. Re:Now, if we can just get Perl 6... by Anonymous Coward · · Score: 0

      No, C++0x started about the same time as perl 6.

      Perl 6 is dead. From the very beginning I knew they would never finish it (much like FLTK2). It was dead from the time they first started the project and were talking about all they stuff they wanted to do. Just the shear amount of work was impossible. The original Perl developed over a long period of time with features added here and there. They were trying to redo do the whole thing plus add a whole lot more with all sorts of lofty goals and ideas right from the beginning. Recipe for disaster.

      Ground-up redesigns of successful large complicated projects almost never works out. It will either never be finished or be much worse than the original.

  40. And yet... by CountBrass · · Score: 1

    Lisp, the oldest language with GC, solved that problem a long time ago. Here's a simple example for opening a file and writing to it and ensuring all resources are released no matter what happens.

      (with-open-file (s p :direction :output :if-exists :supersede)
            (format s "Here are a couple~%of test data lines~%"))

    Just because C++ can't/doesn't do it/makes it a pain doesn't make it universally true.

    --
    Bad analogies are like waxing a monkey with a rainbow.
    1. Re:And yet... by batkiwi · · Score: 1

      C# has the same moniker, likely copied from Lisp:

      using(StreamReader reader = new StreamReader("file.txt"))
      {
        //do stuff with your reader
      }

    2. Re:And yet... by Anonymous Coward · · Score: 0

      And here's a C++ way:

      ..
      {
            StreamReader reader("file.txt");
      //do stuff with your reader
      }
      ..

  41. Re:C++0xB by u17 · · Score: 1

    Not for unsigned numbers it isn't.

  42. But what to call it ? by Etrigoth · · Score: 1

    I personally like C!!

    And then next year we can be more excited and call it C!1!

    --
    When we remember we are all mad, the mysteries disappear and life stands explained.
  43. When will the book be available? by mark-t · · Score: 1

    A quick perusal on Amazon didn't find anything called the C++11 Programming Language, which is what I would have expected.

    I know I can read all about it online, but I like having real books... okay?

  44. Re:C++0xB by maxwell+demon · · Score: 1

    Actually, I'd argue that with unsigned numbers, overflow does not exist because unsigned arithmetic is defined modulo 2^N. But anyway, for unsigned overflow throwing an exception would not even be allowed.

    --
    The Tao of math: The numbers you can count are not the real numbers.
  45. The best is yet to come by loufoque · · Score: 1

    This standard is late and is full of little quirks.
    It has some pretty nice stuff, but some areas still leave to be desired.

    Hopefully evolution will resume now, and the upcoming work and standardizing meta-programming, domain-specific embedded languages, AST manipulation, polymorphic lambdas, constrained templates, concepts, axioms and modules will be able to take form.

  46. Link to working draft by Anonymous Coward · · Score: 0

    Anybody got a link to working draft n3290 or n3291? It was removed from the website after they said it was finished.

  47. keep your crazy C++ stuff, I have C by Anonymous Coward · · Score: 0

    The C++ standard continues to go down the crazy road.
    C++ is a bunch of hacks on top of C.
    To keep those hacks working when adding new features to the language, they have to invent even more hacks.

    I'll just take the C language as it is.
    It's true that c99 and C1x also have some crazy in it, but there's also genuinely good stuff, some of that ported from some of the less crazy C++ ideas.
    But for most purposes, C89 is fine.

  48. C++0x by Anonymous Coward · · Score: 0

    Keeps reading like "cox"

  49. Who has signed up to write a compiler for this? by ahoffer0 · · Score: 1

    Has Intel, PGI, Microsoft or IBM committed to producing a commercial quality C++0x compiler?

  50. So when can I ... by ylleKnaD · · Score: 1

    get a C++0x compiler that supports PIC12F508 microcontrollers?

  51. Why this name? by unixisc · · Score: 1

    I thought we had all the programming languages we need. After Java, we shouldn't have needed anything more. But if we were to have a step higher than C++, why this bizarre name? Why not D, or P (after BCPL)? And what does this language do that no other does well? (No, I don't know what lambda functions are - will look it up in Wiki)

    1. Re:Why this name? by Anonymous Coward · · Score: 0

      I thought we had all the programming languages we need.

      Nowhere even remotely close to true. The state of programming is in the dumpster, especially in terms of what's mainstream. Mainstream languages are still yet to catch up to... well, languages of the 60's. (See: LISP.)

      There are only a few people (e.g. Alan Kay and his organization) that I know of that are actively doing research on advancing the state of programming itself in a significant way. We're going to eventually simply hit our limit with what we can do with current mainstream languages and their lack of significant abstraction capabilities.

      You can see a talk about the kinds of things Alan Kay and co. are attempting here.

      They post papers and what not here.

    2. Re:Why this name? by Anonymous Coward · · Score: 0

      It is not a new language it is just a new *revision* of C++ - it has a "bizarre" name because that is the working name for the standard draft.
      It does everything C++ already did well plus some new things now that is has been revised.

      Does being this ignorant not embarrass you? You should be ashamed.

    3. Re:Why this name? by unixisc · · Score: 1

      Nope, b'cos I'm not a programmer. Just curious about all the progamming languages out there. But yeah, tell us what you really think!

    4. Re:Why this name? by phrank · · Score: 1

      The D programming language exists and worth a look: http://d-programming-language.org/
      I could not find any P, only P#.

    5. Re:Why this name? by Branciforte · · Score: 1

      It's not a new language any more than Java6 is a different language than Java5.

      What it provides is an efficient low-level language with convenient features to support high-level ideas. without the incredible bloat associated with Java.

  52. There's a clue in that phrase. by Anonymous Coward · · Score: 0

    In fact, that's how the early c++ "compilers" did it.

    There's a clue in this phrase. If a compiler can do it (infallibly), why should you have to?

  53. Um, no. by warrax_666 · · Score: 1

    Oh noes! You actually have to be smart to be a C++ programmer. Oh the horror!!! THE HORROR!!!!!!!!

    Um, no. You have to be a robot to be a C++ programmer. Writing C++ is absurdly cumbersome and error-prone (what's the standard up to now, 1500 pages?) for some theoretical "efficiency" gain.

    The smart way would be to choose a language which helps you get the job done with the minimum amount of fuss. If that entails extreme efficiency, then maybe you'll want to use C++ (or more likely C), but there are very few places these days where has any place.

    --
    HAND.
    1. Re:Um, no. by Anonymous Coward · · Score: 0

      Unbelievable amounts of bullshit in Slashdot these days.

      Writing C++ is neither cumbersome, nor error-prone, and you never had to read a standard to write perfectly working, bug and hassle free, easy-to-maintain and idiomatic C++. There's nothing theoretical about the efficiency gained through native code against virtual machines – or worse yet, interpreters. The only thing required from a C++ programmer is to not be an idiot. Idiots write idiotic code in any language and are not really ideal software engineers anyway.

      When choosing C++, you can be sure you can reuse your stuff after 25 years. With proprietary languages you'd be lucky to have support for a new, less popular platform in a year.

  54. Re:C++0xB by CuBr · · Score: 1

    C++0xB is a cleverer name since it can be interpreted in two ways:
    1) Since C++0x wasn't completed in 200x as expected, it's time for plan B, namely C++0xB.
    2) 0xB represents 11, since 0x is the prefix for hexadecimal in C++. And so C++0xB still literally means the version finalised in 2011.

  55. Memory Required by Dragon+Bait · · Score: 1

    Ditto, and more importantly, if I add a private data member why should I have to re-compile anything other than the class?

    Private members are not even a part of the public interface!

    When you add a data member (private or otherwise) it changes the memory foot print of an object. If the compiler forced everything to have an implied pImpl (allocating everything on the heap) then it could probably get away with out a recompile but at the cost of performance. Since you can allocate objects on the stack (or possibly even simple ones in registers), the memory foot print of the object needs to be known by the user of the class.

  56. In Soviet Russia by epine · · Score: 1

    In Soviet Russia Rccp compiles you. Obviously my first attempt was a typo. Also slashdot borked my R operators which were supposed to be [<-, [[<- etc.

    Now I see Slashdot also borked some words nearby while entirely failing to notify me of its textual appetites. Lazarus to the rescue, which by some miracle of resurrection has translated < to &lt; for me.

    ==Restoration of slashdot borkage==

    R operators [], []<-, [[]], [[]]<- do the same kind of type polymorphism at runtime that generic programming in C++ does at compile time, only with an even poorer sense of what the interface is required to document. Because of stupid semantics to automatically drop rank to eliminate dimensions of length 1, you can't even get your rank analysis correct half the time. APL had this nailed in 1965. (The stupid drop semantics can be disabled if you subscribe to the long list of "things to remember" so often used to flail C++.) To get rank analysis right, you have to distinguish scalar values from vectors of length 1, which R does not do on your behalf. In the context of a list, operator [[]] behaves like a scalar subscript, shedding a subscript dimension, while [] behaves like a vector subscript, slicing the object into a subset, by not changing rank or type. In other words, even in cases where STL would tell you that your algorithm is generic, in R you have to dispatch on type to get your subscript syntax right.

    Both these languages suck a dozen ways from Sunday, but in the union of the two I'm happy as a pig in mud. Deep down I'm fairly certain that if any of 90% of the sentiment about C++ expressed on this thread had taken root in the C++ standards committee, I wouldn't now be enjoying the goodness and broad shoulders of Rcpp.

  57. Blah blah by warrax_666 · · Score: 1

    Straw men, hurling insults, moving the goal posts, etc. etc.

    You still didn't answer my point: Why should I (as a programmer) be bothered by things that the computer can do for me? (And if your accusation that we are all 'idiots' is to be taken seriously, the computer would do it better.)

    C++ has advantages. Not just ones that matter in this day and age where programmer time is more expensive than computer time. The disadvantages far outweigh its advantages.

    --
    HAND.