Slashdot Mirror


Bjarne Stroustrup Previews C++0x

Szplug writes "Bjarne Stroustrup has a sneak peek at the additions to C++ that he expects will be completed (hopefully) by 2009. Included are language-defined threads, optional garbage collection, some automatic type deduction, and template concepts. From the article: 'The list of current proposals is still quite modest and not anywhere as ambitious as I'd like. However, more proposals are being considered and more libraries will appear either as part of the C++0x standard itself or as further committee technical reports.'"

99 of 741 comments (clear)

  1. What a name! by Caspian · · Score: 4, Interesting

    "C" was an unusual enough name for a language. Then "C++", which makes sense to you or I but would only mystify a non-geek. Now "C++0x"? How is that even pronounced? "See Plus Plus Zero Ecks"? Or maybe just "C...ocks"?

    Names like this serve to only further mystify computing and programming among the non-geek population.

    --
    With spending like this, exactly what are "conservatives" conserving?
    1. Re:What a name! by gravij · · Score: 2, Informative

      Seems like the 0x will be replaced with the year it is ratified by the ISO, eg. 09. The same as the ISO standard C++98.

    2. Re:What a name! by RedNovember · · Score: 3, Funny

      You thought that was a weird name, yet you didn't blink at Bjarne Stroustrup?

      As us unfortunate VBers would say, GeekFactor.Value = True

      --
      "MY APOCALYPTIC TENOR HAS NOT BEEN DISPELLED!" - T-Rex, qwantz.com
    3. Re:What a name! by swillden · · Score: 5, Insightful

      Now "C++0x"? How is that even pronounced? "See Plus Plus Zero Ecks"? Or maybe just "C...ocks"?

      Actually, the correct pronunciation will be "See Plus Plus". The name of the language won't change, just as C is just called C, even though K&R C, C89 and C99 are quite different animals.

      --
      Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
    4. Re:What a name! by famebait · · Score: 2, Funny

      Or maybe just "C...ocks"?

      Definitely. That way, all the losers who haven't moved on to modern languages by 2009 can be known as

      [drum roll]

                  C++0x-suckers!

      --
      sudo ergo sum
    5. Re:What a name! by Ekevu · · Score: 2, Funny

      Or maybe just "C...ocks"?

      This is just as bad as the current name. If I look up "cocks" on Google, I will have to sort out between the language and the carnage. Doesn't sound interesting.

      Now, if we call it Pu-C, maybe it won't be that big of a problem. :o)

  2. Should've just done it in Python/Ruby anyways by psavo · · Score: 3, Interesting

    What I started to hate in C++/Java/C# is that there's no easy and standard-conforming way to express complex data 'inline'. Yeah, it's cleaner to make it XML and load it runtime, but there's no simple+quick way to do that either.

    Hell, you can't event put known non-uniform data in C++ vector without doing it one-by-one.

    --
    fucktard is a tenderhearted description
    1. Re:Should've just done it in Python/Ruby anyways by sgt101 · · Score: 2, Insightful

      On the other hand, we could use COBOL, as that has really good facilities for putting data inline with imperative code.

      ohh...

      wait...

      (reads 30 years of literature on databases, furrows brow)

      I think I've seen a problem with that!

      (looks up brightly)

      --
      --------------------------------------------- "In the end, we're all just water and old stars."
  3. I'd just like to point out - we own it by Anonymous Coward · · Score: 4, Funny

    "And C++ programming languages, we own those, have licensed them out multiple times, obviously. We have a lot of royalties coming to us from C++."

    http://techupdate.zdnet.com/techupdate/stories/mai n/0,14179,2877578,00.html

    You know where to send your royalty checks.

    Thanks
    Darl McBride

  4. Re:Worth it? by Anonymous Coward · · Score: 4, Insightful

    There's a reason why languages come and go.

    I agree that ADA and FORTRAN are out and Java and Python are in, but isn't C/C++ an expection?

    C/C++ have been around for many years and show no signs of going away - C++ was initially developed in 1983, while C itself hails from the early 1970s - and they're still popular to this day. And, of course, C++ "bolted on new features" to C. In fact, C++ was initially called 'C with classes'.

    As far as I'm concerned, as long as C++ is "the standard language" in so many places we may as well make it not suck in comparison to other languages, which we can do by appropriating the nice features of those other languages.

    Just my $0.02,

    Michael

  5. Lisp by lisaparratt · · Score: 3, Funny

    By the time he's finished with C++0x\n==%d, I bet the specification will look suspiciously similar to that of Common Lisp!

    1. Re:Lisp by Lostie · · Score: 4, Funny

      And how will that be pronounced: Thee Pluth Pluth?

  6. Adding new features is not always an improvement by Frans+Faase · · Score: 4, Insightful
    The art of making a programming language lies in giving it just enough features to make everything possible that you want without making thing possible that you want. I feel that at the moment C++ already allows to much "wierd" things that you do not really need in practice. I am affraid that adding new features and new language constructs only will make things worse, not better.

    I also have come to realize that if there is one bad thing in C++ than it is this preprocessing which it inherited from C. Especially in a large project the trouble of including the right files and linking against the matching libraries becomes a pain in the ass. In this respect I would like C++ be more like Java (or TurboPascal for the matter) where interface declarations and compiled code are unified. At the moment moving around code from one DLL to another is a lot of work, while in my perception, it could have been completely transparent from the users point of view.

    I do realize that keeping backwards compatibility was one of the design features of C++, and that it also determined the success of C. But as many C++ tools are now able to make use of precompiled headers, it seems that the problem should be able to be done away with.

  7. More features - is that what C++ really needs? by JackDW · · Score: 5, Insightful
    I'm a long-time fan of C and C++, but I've been converted to Python recently. Endlessly copying the C model is a bad idea. C++ did it, Perl did it, then Java copied C++, and all are perfectly servicable languages, but they are not clean, simple or pretty.

    If we want to write complex and secure programs quickly, we need better languages, and more features does not mean better.

    --
    You're an immobile computer, remember?
    1. Re:More features - is that what C++ really needs? by masklinn · · Score: 3, Insightful

      Sorry, I have.

      Ruby and Python are more or less equivalent languages, extremely similar in most constructs and ways of life, and rougly 90% of the "differences" between the languages boil down to syntactic sugar.

      And please, I beg you, don't bring Blocks in this by saying something as stupid as "woohoo, blocks are liek magic, no one else has it, they're cruise control for greatness", blocks are anonymous functions period (in the Functional Programming sense of the term, e.g. functions with closures that are first-class objects), the concept is more than 30 years old... (and not OO at all, meaning that the "top of the line" feature of the OO herald language is purely functional).

      Ruby is an extremely fine dynamically strongly typed language with an extreme object orientation, Python is likewise. None of them is "better than the other one" in an absolute sense and claiming the opposide is stupid, the one you choose is purely a matter of taste. You prefer Ruby? good for you, I prefer Python, and that makes neither "the ultimate language".

      This fucking ruby hype is becoming extremely tiring, and doesn't help Ruby.

      End of the rant

      --
      "The way we can tell it's C# instead of Haskell is because it's nine lines instead of two." -- wadler
    2. Re:More features - is that what C++ really needs? by masklinn · · Score: 2, Insightful

      Python indentation defines blocks (end of blocks, to be precise). I kind of fail to see how using braces or begin/end construct is "cleaner", especially since you indent languages using braces or blocks keywords by blocks anyway (see, getting rid of keywords/braces is all python does).

      Less typing, less misindented code and a lower rate of confusing constructs look cleaner to me.

      --
      "The way we can tell it's C# instead of Haskell is because it's nine lines instead of two." -- wadler
    3. Re:More features - is that what C++ really needs? by blair1q · · Score: 2, Insightful

      Cut and paste it a few times, then come back and see me for these: {{{{}}}}

    4. Re:More features - is that what C++ really needs? by Abcd1234 · · Score: 2, Informative

      in the Functional Programming sense of the term, e.g. functions with closures that are first-class objects

      You'd be absolutely right, assuming, of course, that Python actually supported true lexical closures, which it doesn't...

      Of course, I'm not so silly to think that Ruby is unique in supporting this concept. After all, the creators of Ruby stole most of their ideas from Smalltalk, who, in turn, stole many of their ideas from LISP (although, admittedly, LISP didn't switch to lexically scoped closures until somewhat later in it's lifespan). It's just a shame that Python hasn't done the same.

  8. C++09??? by mwvdlee · · Score: 2, Funny

    The work on C++0x has entered a decisive phase. The ISO C++ committee aims for C++0x to become C++09.
    C++ octal-9???

    --
    Slashdot social media options: AIM, ICQ, Yahoo, Jabber and Mobile Text. Why no MySpace?
  9. Slashdot interview? by nyri · · Score: 5, Interesting

    How about having a slashdot interview about C++0x with Strousrup? I think it would be a good forum to gain more insights about C++ and a fine possibility to allow a community (in this case the slashdot readers) to make and to vote on feature proposals.

    1. Re:Slashdot interview? by joeytsai · · Score: 2, Informative

      Slashdot has actually already had an interview with Bjarne:

      http://slashdot.org/developers/00/02/25/1034222.sh tml

      --
      http://www.talknerdy.org
  10. This has brought out the C++ haters by MeridianOnTheLake · · Score: 5, Insightful

    This has really brought out the C++ haters. Still, most commercial applications, games, utilities, OS's, etc are still written in C++ (or a combination of C and C++). There is a reason for this; it is because C++ is both incredibly effective and extremely efficient. Sure, its possible to create artificial benchmarks that prove otherwise, but in te real world where performance counts, people use C++. But when they want flexibility they go for Ruby or Python or something similar. If you want outstanding applications, you use an outstanding language like C++. If you want average applications, you use an average language like Java.

    1. Re:This has brought out the C++ haters by ultrabot · · Score: 2, Funny

      This has really brought out the C++ haters. Still, most commercial applications, games, utilities, OS's, etc are still written in C++ (or a combination of C and C++).

      And the guys who write those apps are the very ones who hate C++.

      You have to use C++ for a couple of years to truly, honestly hate the language.

      --
      Save your wrists today - switch to Dvorak
    2. Re:This has brought out the C++ haters by MORB · · Score: 5, Insightful

      "And the guys who write those apps are the very ones who hate C++."

      Not all of them. I've worked for 6 years as a game developer, and I've seen (and written myself) some pretty horrible stuff.
      Yet I actually love C++ now, even though I hated it at first.

      What I hate are people not thinking thing through before they code and hence writing monstruous code.
      And most of these monstruosities are not C++ specific. A programmer who is not able to figure out what to put in a separate function or how to make a proper class hierarchy won't magically do better in Java, C#, Python or whatever else.

    3. Re:This has brought out the C++ haters by Profound · · Score: 3, Insightful

      >> numbers of commercial applications right now, Java dominates.

      I don't know about that, depends on how you classify "commercial applications right now"

      -Number of stand alone applications running on people's PCs around the world? Definitely not.

      -Number of programmers employed and/or counting webapps as applications? Probably yes.

    4. Re:This has brought out the C++ haters by PenguiN42 · · Score: 3, Insightful

      No, they aren't. C/C++ is still used for the widest range of applications, but in terms of numbers of commercial applications right now, Java dominates.

      An earlier poster commented that the very programmers who have to write the C++ apps are the ones who hate C++.

      I would like to add that the very users who have to use the Java apps are the ones who hate Java.

      --
      The following sentence is true. The preceding sentence was false.
    5. Re:This has brought out the C++ haters by diamondsw · · Score: 2, Funny

      You have to use C++ for a couple of years to truly, honestly hate the language.

      Whereas Perl only takes a few minutes. Such efficiency!

      --
      I don't know what kind of crack I was on, but I suspect it was decaf.
  11. Lots of detractors here by Dante+Shamest · · Score: 4, Interesting

    But considering that lots of OSS projects like Firefox and KDE still use C++, not to mention commercial games like World of Warcraft, C++ probably does have some saving merits.

    1. Re:Lots of detractors here by HumanTorch · · Score: 2, Funny

      Perhaps it's because all the Python folks have more spare time from programming in a more productive language.

  12. My wish-list for c++ by Eternal+Annoyance · · Score: 4, Insightful
    property keyword: Used that in object-pascal (the language sucks otherwise). Just define a read and write function, make a property which calls those functions and you can go ahead. Very simple in use (less bug prone), fast to implement and nice on the compiler. While you can achieve the same in c++ it's not as clean and friendly on the compiler.

    interface and implementation (both are keywords, comes from pascal) section: lets get rid of seperate header and code files. The idea is aged, inefficient and doesn't help clarity nor ease of coding.

    Bit-arrays: yesyes, I know. Boost contains a class which does that. But I think it would be so much nicer if the language had that feature.

    1. Re:My wish-list for c++ by andersa · · Score: 2, Insightful

      Headers make things vastly more efficient when dealing with system libraries; it would be crazy to compile everything

      There is no reason the compiler shouldn't be able to ignore the implementation section when you are just using the interface. Of course you need the entire source, instead of just the header files, but that's a minor inconvinience in my opinion.

      And whether it makes coding easier is a matter of taste.

      Btw: I am a total Delphi fan..

  13. Re:2009? by frantzdb · · Score: 5, Insightful

    I doubt Google, Adobe, or many of the thousands of other companies depening on C++ will be throwing their code base away any time soon. Rather, they will want their C++ code to be more robust and more managable. The features the article lists all seem to do this.

    (See Stroustrup's C++ Applications page for more.)

  14. Re:Downhill at a fast rate by famebait · · Score: 5, Funny

    Tell me about it! And those fancy editor thingamajiggs? A-phoooey! Real Programmers use cat(1) and do it right the first time!

    --
    sudo ergo sum
  15. Re:Worth it? by Greyfox · · Score: 5, Insightful
    C++ is evolving via committee, so its growth tends to be both slow and seemingly ridiculously complex. Also usually for the better though. The last major change I recall seeing from them added templates and exceptions. Arguably neither was necessary for the language, but I think both additions helped it out. Since then folks like Alexandrescu have been doing nifty things with those features, and the boost library is based on a lot of that work. From what I can tell, the committee is actually looking at that work and are shaping C++ in a way that tries to help it in the future. Thats much better than having them go off and do their own thing without looking at what the community is doing.

    C++ is a tremendously type safe language, to the point where every time I work with it I feel like about 90% of the work I do is in accounting for type. Most of that work is thrown away after the code has been compiled, too, but it does make for a rock solid program if you do it right. It seems to deliver on a lot of the promise of ADA, really. If they can improve access to its features without compromising that type safety, I'm all for it.

    --

    I'm trying to teach myself to set people on fire with my mind... Is it hot in here?

  16. Re:Downhill at a fast rate by jcr · · Score: 2, Insightful

    I still think C++ was invented as a joke.

    Not a joke, a research project. Thus, Stroustrup's willingness to include any "feature" that someone suggests: "Oh sure, we'll put that in and see how it works out."

    The upshot is a language that is accreted instead of designed.

    When I found the C language, I stopped looking. Ah well.

    Too bad.

    -jcr

    --
    The only title of honor that a tyrant can grant is "Enemy of the State."
  17. Re:Worth it? by frantzdb · · Score: 4, Insightful
    C++ is a tremendously type safe language, to the point where every time I work with it I feel like about 90% of the work I do is in accounting for type. Most of that work is thrown away after the code has been compiled, too, but it does make for a rock solid program if you do it right.
    From my experience using C++ in the field, I basically agree. While type safety can be a headache, there are many errors that strong typing eliminates entirely, almost to the point that "if it compiles, it's correct". While much type information is "thrown away" at compile time, I always find that careful consideration of type is necessary to correctly implement something large. When I have trouble mapping the problem domain onto a strictly-typed mental model, it generally means I really don't understand the problem.
  18. Re:Worth it? by LucidBeast · · Score: 2, Informative

    To us stuffy old farts things keep moving way too fast. I just got gazillion errors from the spanking new compiler, because the scope change to the variables declared inside for loops.

  19. Re:Heh by mrsbrisby · · Score: 3, Insightful

    What would you prefer - Stroustrup does it all single-handed?

    It might be nice if he could.

    Stroustrup lives in a fantasy world where the only reason C++ isn't as fast as C, or produce as small of assembly as C is because of the compilers- which he conveniently disavowes responsibility for.

    Compare to Objective-C: You'll note that these new C++ "concepts" feature are extremely similar to Objective-C's "protocols"- only not only can a moderate programmer produce a fast Objective-C compiler, they'll know exactly where it can be slowed down and why.

    It'll also already be able to do these things in C++ that are so new and innovative.

    Meanwhile, some C++ compilers can make "cout << 1 << endl;" slow- and others only do it when the programmer tries to make their own "cout" like device.

    If the libraries were lumped in with the core language, C++ would be a much less flexible and less appropriate tool for those kind [systems programming] of tasks.

    No, it's if those libraries imposed greater responsibilities on the runtime. As it stands, the C++ runtime already has an awful lot to do- albeit less than Java or Objective-C.

    Worse still: The C++ runtime isn't a peer to your own code as it is in Objective-C: With Objective-C you can interact with the runtime as if it were regular library calls.

    C has a mountain of library code available, and the functionality of that library code drives new extensions to the C core language (TLS extensions, for example)

    But then, C has almost zero runtime (and if you reject certain extensions: it actually has no runtime), and that's what makes it suitable for systems programming.

    I don't think C++ is now, or ever was (or with the way these "extensions" keep showing up) - or ever will be suitable for Systems Programming.

    Because the C++ programmer infrequently can understand what his runtime is doing- and is not encouraged to know the interface by which C++ does it's magic (because nobody knows- they're still trying to figure out how to make some C++ magic work in a way that isn't slow)- a C++ systems programmer needs a C++ runtime. Nobody has one in systems-space, so the C++ programmer (which isn't a programmer of C++) needs to write it.

    The inventor of C++ can't even do this, but any moderate programmer could do this for Objective-C.

  20. Re:Downhill at a fast rate by BenjyD · · Score: 2, Insightful

    It's not that hard to see if there's a 'const' in the function prototype, is it?

  21. The GUI. by nighty5 · · Score: 2, Insightful

    I was pleased to notice that Bjarne Stroustrup has acknowledged that they won't be pursuing to include a GUI framework into the new C++ standard.

    Although this might be considered a disappointment, his citing the fact of low resources, time and money are best spent in other areas. Lets get something out the door that we can use now instead of waiting for the GUI. I'm no C++ expert, as a matter of fact I'm only into about 400 pages of my first teaching book ;)

    Nobody will deny the power of some of the C++ GUI's out there, QT is probably best of breed. Its probably good to have commerical interest in the GUI space, since the desktop is forever evolving faster than a C++ committee could handle.

    1. Re:The GUI. by ObsessiveMathsFreak · · Score: 2, Interesting

      Nobody will deny the power of some of the C++ GUI's out there, QT is probably best of breed.

      Using a procedural, compiled programming languague for GUI's is a fundamentally flawed concept to begin with. If you want to create a user interface, just use HTML, XUL, XAML whatever. 300+ lines of Visual C++ code just to display hello world is indicative of an underlying problem.

      --
      May the Maths Be with you!
    2. Re:The GUI. by trollable · · Score: 3, Insightful

      300+ lines of Visual C++

      If you're right, WTF would you want to use a MS product? You can do a hello world in C++ with just 3 lines (TUI) or 12 (GUI with QT).

      Concerning XML-based GUI descriptors, it is in general not smaller. It is smaller to define and place the components but things goes wrong when you have to manage events. In fact, from my experience, a GUI in HTML+JS, C++/QT and Java/Swing has more or less the same number of SLOC.

    3. Re:The GUI. by ivec · · Score: 3, Insightful

      There are many C++ GUI libraries, but I'm afraid that they all share a common weakness: the lack of reliance on the standard C++ library. Except maybe gtkmm, but how well is this library supported?

      All the frameworks I know tend to use their own string class, their own containers, etc -- and obviously as well their own threading library.

  22. Re:Downhill at a fast rate by mustafap · · Score: 2, Informative

    >> When I found the C language, I stopped looking. Ah well.
    > Too bad.

    I guess I should have qualified my comment, really. I suppose in part it comes down to what problems one is trying to solve. I'm an embedded designer, working on small systems. Assembly and C turned out to be the right tools for the job. So I guess I should really have qualified my rant with "in my line of work".

    The red mist has lifted now!

    --
    Open Source Drum Kit, LPLC deve board - mjhdesigns.com
  23. C++ template concepts vs. C# generics constraints by dalleboy · · Score: 2, Informative
    The difficulty in the design of "concept" is to maintain the flexibility of templates so that we don't require template arguments to fit into class hierarchies or require all operations to be accessed through virtual functions (as for Java and C# generics). In "generics", an argument must be of a class derived from an interface (the C++ equivalent to "interface" is "abstract class") specified in the definition of the generic. That means that all generic argument types must fit into a hierarchy. That takes foresight. For example, if you write a generic and I define a class, people can't use my class as an argument to your generic unless I knew about the interface you specified and had derived my class from it. That's rigid.

    C++ template concepts are no better (or worse for that matter) than C# generics constraints, they only bind differently: C++ binds to a name, C# binds to an interface. Both are equally rigid. Both require foresight. In C++ you don't have to derive your class from a specific interface, but on the other hand you still need to implement the function knowing what name it will be accessed through (i.e. should it be named begin or Begin or GetBegin).
  24. Threads Cannot be Implemented as a Library by putko · · Score: 3, Interesting

    It is good for a language to have threads "built in". As mentioned in this paper, "Threads Cannot Be Implemented as a Library": http://www.hpl.hp.com/techreports/2004/HPL-2004-20 9.pdf

    if you do threads in a library, you run into problems with semantics or performance. Semantic problems == compiler breaks your multithreaded program. Performance problmes == compiler does naive translation of program, terrible performance.

    --
    http://www.thebricktestament.com/the_law/when_to_s tone_your_children/dt21_18a.html
  25. Re:Downhill at a fast rate by Anonymous Coward · · Score: 2, Interesting

    It can get ugly, if it isn't designed.
    But if you spend just a little up-front design time, it is also very easy to create nice clean code.

    Refactoring C after a year of development is not that hard.
    Refactoring C++ after a year of development can be impossible.
    Did you say reuse? Bah.

  26. what's in a name by Claire-plus-plus · · Score: 2, Funny

    they should call it ++C, so then the "shouldn't you iterate the language BEFORE you use it" jokes can go away.

    --
    99 bottles of beer in 175 characte
  27. Re:Heh by Kjella · · Score: 4, Insightful

    Translation : C++ will continue to be a highly useful language, as long as some other sucker does all the hard work.

    Well, the power of most languages is in the libraries anyway. What is Java or C# without the standard libraries? I program in C++/Qt and rarely if ever touch all that is ugly about C++. The very few places I allocate memory myself for operation with other code I check it rigorously, Qt objects handle themselves. I use QString and QBytearray and never have issues with zero-termination or buffer overflows. Signals and slots will never crash on a dangling pointer. The new Qt4 containers with foreach are brilliant. So yeah, core C++ may be functionally poor but if you need the equivalent of java or C# it's a library away.

    Kjella

    --
    Live today, because you never know what tomorrow brings
  28. Don't worry - We'll license you case-by-case by Anonymous Coward · · Score: 4, Funny

    http://www.mozillaquest.com/Linux03/ScoSource-02_S tory03.html

    "C++ is one of the properties that SCO owns today and we frequently are approached by customers who wish to license C++ from us and we do charge for that. Those arrangements are done on a case-by-case basis with each customer and are not disclosed publicly. C++ licensing is currently part of SCO's SCOsource licensing program."

    Thanks
    Blake Stowell

  29. Re:Just get rid of it altogether by Anonymous Coward · · Score: 2, Funny

    "Dude, have you ever heard of text formatting?"

    As a die-hard C/C++ fan, he figures redundant whitespace will just compile out in the end.

  30. Re:Downhill at a fast rate by Bloater · · Score: 5, Informative

    > And reference variables?

    There is no such thing as a reference variable, you clearly don't know the C++ language. references are not variables. references are newly defined identifiers that refer to an object that already has identifiers referencing it, they don't change, ever, hence are not variable... But I see that you *really* meant *pass* by reference, if you want to ensure that the function can have no side effects, cast the parameter to const. Otherwise, if you expect to write software without knowing what the functions do, you should not be writing software.

    BTW, when you say "fancy allowing standard operators to be overloaded" I think you mean "overrided". C has overloaded operators (+ is defined for int, char, short, long, float, double, etc). overriding lets you tell the compiler how to do addition for your custom bigint library, or whatever. You can misuse operator overriding, or you can misuse macros, each are there for a purpose, and each get misused by bad programmers.

    > And now garbage collection? That just a feature to fix poorly written code.

    No it isn't, it is a feature to simplify the determination of object lifetime when that lifetime depends on complex (or more likely, merely chaotic) runtime factors. Bad programmers use it to fix poorly written code. Sure, every lifetime can (maybe) be determined by some complicated equation, but when you have limits on how much CPU you can use and limits on how much time you can spend on maths, you use garbage collection.

    The trick is only to use garbage collection when you know that you need it and what it means. There's the problem with most dynamic languages.

  31. Re:Adding new features is not always an improvemen by hackstraw · · Score: 2, Interesting

    I also have come to realize that if there is one bad thing in C++ than it is this preprocessing which it inherited from C. Especially in a large project the trouble of including the right files and linking against the matching libraries becomes a pain in the ass.

    Even though headers and libraries are the most common problem I come across from day to day, it wasn't until now that I thought about it as an implementation problem.

    I'm not sure about the preprocessing bit. ifdefs and includes to get prototypes and other global/module specific variables are very handy. Its just a little silly that there is not a common preprocess and link flag that you can tell your compiler to find includes and libraries. How about gcc -F /usr/local/strange_module-2.3.7 and that would pass -I /usr/local/strange_module-2.3.7/include to the preprocessor and -L /usr/local/strange_module-2.3.7/lib to the linker.

    How tough would that be? You can always explicitly add linker or preprocessor flags if you need to, but I would find this method superior to the current one by far. One of the biggest issues with preprocessing and linking is the order of the search path. Having it as one flag to pass to both of preprocessor and linker would simplify things.

  32. C++x0r by CharAznable · · Score: 2, Funny

    I think he means to call it C++x0r. Cause the type safety makes you ub4r.

    --
    The perfect sig is a lot like silence, only louder
  33. Why wait to 2009? by shenanigans · · Score: 2, Informative

    I personally have more hope in this alternative.

    To me, D has surfaced to become what I always thought C++ should have been. I hope (and believe) that it will be giving C++ more competition in the comming years. It might not be ready for full production yet (due to lack of big supporters and libraries, mostly), but I have tried it out on several of my own projects, and I love it.

    1. Re:Why wait to 2009? by deadlinegrunt · · Score: 2, Informative

      "I'll never understand why it's not possible to even enable bounds checking in STL arrays..."

      If you read "The C++ Programming Language" you will find out exactly why this isn't enabled in the default libraries. Also how to provide a trivial wrapper with just a few lines using at() and why it is left to you to do so instead of specified by the standard and implimentation details. Granted you said it's not "even possible to even enable..." when in fact this is not true. There are implimentations of C++ that actually do enable such switches during compilation.

      --
      BSD is designed. Linux is grown. C++ libs
    2. Re:Why wait to 2009? by Crayon+Kid · · Score: 3, Informative

      I can't understand why so many programmers stick with C++. It's just not a very good language.

      That may be true (subject to debate). But the main reason is that it's everywhere. It spread and support is simply unmatchable. Even a huge corporation like Microsoft, trying to push an alternative (.Net) has a tough time making a dent in C++. Whatever shortcomings C++ may have, it's already here, everywhere, and it's not that bad as to provoke mass migration.

      --
      i ate crayons when i was a kid and now i have two braincells and the blue ones taste nicer
    3. Re:Why wait to 2009? by Anonymous+Brave+Guy · · Score: 2, Insightful
      I can't understand why so many programmers stick with C++. It's just not a very good language.

      That depends on your benchmark. Mine is pragmatism, where it remains unrivalled for many jobs.

      And while C++ has many theoretical design flaws that could be improved in a language without the historical baggage, lack of bounds checking on a vector isn't one of them. Just use at() instead of [] if your implementation doesn't do bounds checking already.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  34. what is he taking OUT? by Russ+Nelson · · Score: 2, Interesting

    It's much more interesting to me to hear about what Barne will be taking OUT of C++. Adding features is the easy, wimpy part of the job. Removing them is the part that takes cohones.
    -russ

    --
    Don't piss off The Angry Economist
  35. Re:Naming... by ClintBartonWannabe · · Score: 2, Informative

    ++ is the increment operator, C++ is C that has been incremented with new OO features (be that for better or worse is a personal opinion in the same league as religion)

  36. Is the C++ standards committee serious? by master_p · · Score: 4, Insightful

    Why do they want so many years to decide on so simple things that are other languages take for granted for more than 15 years now? Let's see what they have in store:

    1. the using declaration for making type aliases. First of all, template typedefs are there for the exact same reason. Secondly, C++ lacks the ability of making strong types out of other ones, templates or not; a feature present in Ada 83, for example. We programmers need the ability to define strong types out of anything, primitive, template or not.
    2. sequence constructors; what an utterly hopeless idea! it will introduce more problems than anyone ever thought. The correct thing would be to make the expression {2.3, 1.2, 6.7, 4.5}, and any expression contained in curly brackets, a composite literal! Just like an integer can be written as {0, 1, 0, 1 ... 1, 0, 0, 0, 1}, i.e. a sequence of bits, so should any other data structure. Array syntax would be more than enough for accessing the individual elements of a composite literal. For example: auto x = {1, 2, 3}; auto sum = x[0] + x[1] + x[2];
    3. template concepts; correct solution, but why they say it is difficult to implement? The problem with templates was that the type system was applied after template substitution. In fact, templates were little more than C macros. Languages that implement generics correctly (Haskell, Ml, Erlang, Ada, etc) have sold these problems many moons ago. Applying a type in compile time is nothing more than executing the program at compile time. Currently C++ templates are turing complete, so I just do not see 'big problems' with concepts.
    4. type deduction using the auto keyword. C++ already does type deduction, so where is the problem? And why should we wait 4 years for compilers to adopt those things?
    5. .

    But what makes the most negative impression is the willingness to recognize that the programming language world has made huge steps in the last few years, and C++ is light years behind. Here are some of the negative points, in random order:

    • No garbage collection. Come on C++ guys! how many times have we got to beg for C++ having garbage collection? it's the easiest thing to do, and you can put it there as an option! no, the Boehm gc does not cut it, because it does not take advantage of type information, so it is much slower and much more complicated than what it needs to be. C++ designers, please stop telling us how garbage collection will mess up C++, because it will not! Microsoft already has managed C++, and then there is the programming language D which offers garbage collection! Of course gc goes hand-in-hand with strong and weak pointers.
    • the bias towards systems programming . Come on guys! in the world that Java is used for handheld devices, no one really cares about C++ being used in a few embedded controllers anyway. No one has used C++ for any major operating system, and no one has used C++ for any hardcore military project. Where is C++ used as for system programming? nowhere. C++ is mainly used in application programming, because of compatibility with C without an FFI.
    • the lack of import declarations. In the year 2006, we still have to duplicate code between header and source files, we still have to take care of includes, we still have to make decisions if we should place code in header files or in implementation files in order to make code inlined or not.
    • no static virtual methods. It is dead easy to do, and sometimes it is badly needed. For example, the pattern factory heavily depends on it.
    • no properties. For example, GUI libraries have 100s of widgets, yet we still have to write getFoo(), setFoo(), isFoo() etc. By using properties, code would be greatly simplified, and there would be no run-time overhead since properties is about syntactic sugar.
    • no variable argument li
    1. Re:Is the C++ standards committee serious? by DoofusOfDeath · · Score: 4, Informative
      ... and no one has used C++ for any hardcore military project.

      I'm surprised that you feel qualified to make this statement, since it would require you to have the rare combination of having top secret clearange (in order to know about all military projects) and have a "need to know" about each one of them and be in the habit of posting what you know to Slashdot.

      But you're simply incorrect in your statement.

    2. Re:Is the C++ standards committee serious? by tchernobog · · Score: 4, Insightful

      If these are your points, then use another language, like Java.
      I don't want C++ to look like Java.
      I want C++ to solve a different kind of problems in an easy way.

      Frankly _none_ of your points would be something that I'd like to see added to the language; it would be likely to introduce complexity and confuse users even more, instead of helping them; and maybe it would also break compatibility with old C++ programs. It seems that the ISO committee agrees with this idea.

      Some of your points debated:

      • Garbage collection: making this the default would be utterly insane. GC has to run on another thread, thus making a program unpredictable.
      • the lack of import declarations: thanks God we don't have them! Keeping headers and implementation in two different files is a wonderful idea; and I can ship to the user directly my clean and documented header files. No Java-style cluttered and bloated source files. Btw, Java is different because it's compiled in bytecode. C++ isn't, so implementing an import semantic would break C++ ABI (yet) another time.
      • no standard GUI library: different systems get this done in different way. What would be the point of laying out a framework in the C++ standard when nobody would use this because they already do it their own way? We're talking about graphical toolkits with millions of users and bindings in a lot of different languages. Changing the way they do things without breaking binary compatibility for library users is just impossible.
      • No closures: I don't know if I understood your example correctly, but with Gtkmm + sigc++ I do what you said without particular problems.
      • No initialization of an object's fields at the point of their declaration: yes, this is left as a boulder for the programmer. No harm in that, you're just speaking about syntactic sugar.
      • properties: mark a member public if you want to spare some typing. Else use an IDE that generates accessors for you. All in all, it's just laziness...
      • No true message passing: use a library that provides them. As simple as that.

      So please: change programming language and don't complain non-sensically trying to look cool because you can speak a little jargon.

      --
      42.
    3. Re:Is the C++ standards committee serious? by sethg · · Score: 2, Insightful

      One of the main design goals of C++, from the very beginning, is that "you don't pay for what you don't use"--in other words, if you write a C++ program that doesn't use the language's OO or generic-programming features, it should be just as fast as the equivalent C program. I'm not sure how you could extend C++ to include all of your desired features (particularly GC) without throwing out that goal.

      (I think "you don't pay for what you don't use" is a fundamental design flaw of the language, but if you dismiss it, you're no longer arguing about how to extend C++; you're arguing about what language to replace C++ with.)

      --
      send all spam to theotherwhitemeat@ropine.com
    4. Re:Is the C++ standards committee serious? by master_p · · Score: 3, Informative

      If these are your points, then use another language, like Java.

      But I never said that C++ should look like Java. All that I want can easily fit in the C++ style, and they can be optional.

      Garbage collection: making this the default would be utterly insane. GC has to run on another thread, thus making a program unpredictable

      Nope, not at all. First of all, GC does not need to run in a separate thread. I have programmed several GCs, some of them naive, some of them hardcore, and sent them to Stroustrup. None of them required a separate thread. Secondly, you shouldn't talk about predictability and C++ in the same sentence, since C/C++ pointers can easily make a program unpredictable. And if you want "predictability", as you mean it, then be aware that GC can be optional.

      the lack of import declarations: thanks God we don't have them! Keeping headers and implementation in two different files is a wonderful idea

      It makes code management difficult. I have to type the same things twice. I have to decide if a piece of code goes in the header or implementation file.

      I can ship to the user directly my clean and documented header files. No Java-style cluttered and bloated source files. Btw, Java is different because it's compiled in bytecode.

      First of all, you do not need to ship source files. Take a look at programming language D, in which the compiler produces symbol files to be directly imported to programs. Secondly, it is totally irrelevant that a language is in bytecode or not. There are bytecode compilers for C, for example.

      C++ isn't, so implementing an import semantic would break C++ ABI (yet) another time.

      Importing a file it is just another way of accessing declarations between programs. The difference is that imports are already pre-compiled in compiler format, and therefore faster to compile. As for compatibility between compilers, just define a standard (like D does).

      What would be the point of laying out a framework in the C++ standard when nobody would use this because they already do it their own way? We're talking about graphical toolkits with millions of users and bindings in a lot of different languages.

      But new projects will not use the existing graphical toolkits, but the standard one.

      Changing the way they do things without breaking binary compatibility for library users is just impossible.

      Nobody said "stop using the other libraries". But the other libraries are a pain in the a$$ to use. Qt requires MOC, GTK sucks, wxWidgets sucks more, Motif sucks even more. Swing is nice though.

      No closures: I don't know if I understood your example correctly, but with Gtkmm + sigc++ I do what you said without particular problems.

      Nope, you did not. What you are referring to is a callback framework. I am talking about closures. See Smalltalk's blocks, or lambda functions of Haskell/Perl for examples.

      No initialization of an object's fields at the point of their declaration: yes, this is left as a boulder for the programmer. No harm in that, you're just speaking about syntactic sugar

      properties: mark a member public if you want to spare some typing. Else use an IDE that generates accessors for you. All in all, it's just laziness...

      Yes, syntactic sugar, but a very important one: it will save much reduntant work.

      No true message passing: use a library that provides them. As simple as that.

      Obviously, you have no idea.

    5. Re:Is the C++ standards committee serious? by sco08y · · Score: 2, Insightful

      I'm surprised that you feel qualified to make this statement, since it would require you to have the rare combination of having top secret clearange (in order to know about all military projects) and have a "need to know" about each one of them and be in the habit of posting what you know to Slashdot.

      I disagree since if you knew of a reasonable sample of declassified or public military projects and none of them used language X, there's no reason to assume that secret or top secret projects are going to be more inclined to use language X so it would be a reasonable statement.

      That said, I doubt the grandparent had a reasonable sample.

  37. How fascinating by Weedlekin · · Score: 3, Insightful

    Bjarn says he wants to make C++ an even better systems programming language. The way to do this is apparently by adding features to a language already groaning under the last batch, far from all of which have been consistently implemented in all (or even a majority of) compilers. None of these features seem to address the fact that as a systems programming language, C++ has most of the same shortcomings as C, while adding a few of its own:

    1) It is no more portable than C. In particular, various fundamental data types are still dependent on the underlying CPU architecture for their size and format, leading to copious macro #ifdef sections in low-level code that must run on a variety of different systems.

    2) Use of the extra abstraction mechanisms provided by C++ tends to result in code that is both larger and less performant. This is not a desirable attribute in a systems programming language.

    3) It is already an extremely complex language that requires an extremely complex compiler to implement it. This makes it very difficult to validate, thereby rendering it useless for whole classes of systems programming tasks (e.g. high-reliability embedded systems).

    4) The language is a mine-field of ambiguities, overloaded meanings, and counter-intuitive default behaviours that conspire to make it incredibly difficult to learn properly. There are so many potential pit-falls that even very experienced programmers from other languages have trouble writing high-quality code with it, meaning that the language is actually a source of problems in many projects rather than a mechanism for solving them.

    It is thus not (as Bjarn claims) a "better C", at least in a systems programming context, because nearly everything it adds is largely superfluous to systems programmers, and comes at a cost that they are unwilling to pay. This is especially true in what is by far the largest segment of systems programming, i.e. embedded systems, many of which are programmed in _significantly simplified_ versions of C, not the goya-esque monster that is modern C++.

    NB: it is very difficult to design a single language that is equally useful for both high-level applications programming and low-level systems programming because they have fundamentally different requirements. Systems programmers require precise control of minutiae, whereas applications programmers want something that lets them churn build quality end-user systems with a minimum of pissing around. C++ falls between these two stools, adding nothing useful to C's systems programming capabilities, while being so concerned with nit-picking minutiae that writing high-level applications in it is like scrubbing a very big floor with a very small toothbrush. It is IMO well-suited to only one notable application domain: games development, which is unusual in requiring a mixture of both low and high level code.

    --
    I'm not going to change your sheets again, Mr. Hastings.
  38. C++ vs Retards on Rails by zaphle · · Score: 2, Interesting

    I can't believe someone rated you "3 interesting" for a crap post like that.

    It's like judging the quality of a car by the features of the glove department. Obviously you haven't been doing any serious C++ programming to come up with this sort of comment. I suggest you try to read Andrei Alexandrescu (google that up yourself) for some real programming power.

    I can't believe people can be serious about calling Java and C# more modern than C++; they don't even have multiple inheritance or class-local typedefs. Or how about switching your code to call a memberfunction at compile-time vs at runtime (as in templates vs polymorphism). How will you do that if you are forced to use a virtual machine?

    Oh no wait, the next big thing: Ruby on Rails (that's Retards on Rails to me). Everybody in the industry knows the major drawbacks of code generation (generate code, change generated code, IT manager says the specs change, regenerate code, redo the initial changes, notice they don't work anymore, ...) which is why things like templates were introduced as a first in C++ and LATER adapted in languages as Java and C#. So who's leading?

    You people make me tired.

    --
    And what if there's nothing behind the door until it is being opened?
  39. I like some of the proposals for C++0x by jonwil · · Score: 2, Interesting

    Here are some things I personally would like to see (some of which have been mentioned elsewhere as possible inclusions). Not all of them are 100% appropriate for something like C++ and the C++ standard library but all of them are things that seem (to me) to be usefull things to have as compiler and library provided functionality.

    language provided thread support. This would need to provide the following (at least):
    1.Proper thread safety at the language level (including mandates that the standard library is thread safe)
    2.Thread-local storage (i.e. a way to say "this variable is local to this thread")
    3.A way to say "this block of code should only be accessed by one thread at once" or "this variable should only be accessed by one thread at once" (something like a critical section on win32 I guess)
    Plus of course ways to create threads and such.

    Complete compatibility with C99 (i.e. any valid C99 program is also a valid C++0x program and will compile and run)

    something similar to (and compatible with) fstream/ifstream/ofstream except that it reads from a block of memory instead of a disk file

    A nice sane cross-platform way to detect memory leaks (i.e. the compiler implements the standards-specific memory leak detection in the implementation of new and delete and then the progammer would enable it e.g. with a new #paragma or something. (this goes with the garbage collector idea mentioned elsewhere)

    Complete unicode support throughout the C++ language and standard library (although I think this is already mostly there)

    New classes or functions (e.g. a new string class and new/improved collection classes) designed such that they help prevent or miinimize buffer overflows and memory corruption and the resulting effects (sort of like how compiler vendors like microsoft have started to add "safe" string functions only standardized)

    Standardized definitions for constants like pi (plus more math functions as standard)

    A standard library to do data compression and uncompression (perhaps an implementation of what is defined in RFC 1950, RFC 1951 and RFC 1952 i.e. the algorithim and format used in gzip, pkzip and zlib would be appropriate). Further to this, a new fstream/ifstream/ofstream derivitive that will compress data when writen out and uncompress it when read back in (without the programmer having to do anything).

    I like the idea for a standard library way to do directory and file manipulation and the idea for a standard sockets library although (like the compression idea I have above), I do wonder if they are really appropriate for C++ or if they are better provided by third party libraries.

  40. Re:Worth it? by Comboman · · Score: 4, Informative
    C++ is a tremendously type safe language

    Huh?!? C++ is a tremendously type dependant language, which is a very different thing from being type safe. If you type x = y * 3; where x is an unsigned integer and y is a float, a "type safe" language would generate a type-mismatch error at compile. A "type unsafe" language (like C++) would auto-cast without telling you and leave you scratching your head for hours trying to figure out why the results are not what you expected. Yes, that's a programmer error, but a good language should be designed to catch programmer errors at the earliest possible point (compile time).

    --
    Support Right To Repair Legislation.
  41. Stop complaining about things you don't know! by tchernobog · · Score: 4, Insightful

    As far as I can see:
    1) people complaining here about C++ or its will-be features either aren't C++ users or don't understand much of C++;
    2) people who have at least managed to RTFA to the end are complaining about new features of the _language_, that will be _few_, while the biggest efforts will be oriented towards extending the STL, which is the really important part.

    Btw, only a C user that understand C++ poorly could complain about references. If you find yourself at ease with C, by all means, use it. But don't spit on another well engineered language without the necessary knowledge to do so.

    By the way, about references: what's so different when passing to a C function a pointer to a struct, instead of a reference to a C++ one? Don't you have still to read the prototype to know you must pass a pointer indeed? There's just one small difference between C and C++: guess what, if the prototype is a const reference in C++ you've more guarantees the object won't change than with a const pointer in C, since C++ enforces constness. And you don't even have to worry about pointers referencing to free'd memory.

    It would also have been nice if this ./ discussion were about the new features of C++0x instead of the old "C is better than C++", "python is better than C" and "x86-assembly beats the pants off both".
    Oh, well: it's Slashdot after all. What was I expecting. Sigh.

    --
    42.
  42. Re:Adding new features is not always an improvemen by Frans+Faase · · Score: 2, Interesting
    As for the preprocessor issue you describe; it's type-safety.
    I think you haven't understood the issue. Preprocessing is exactly not sufficient to assure type-safety. It has happened often enough (especially in large project with many include paths) that the wrong version of a certain .h file was included to produce a mismatch between to .dll files that would lead to mysterious crashes due to member variables being align differently.

    This is because the .dll file does not contain any information of .h files being used during the compilation. And I hope you can change the "effect" of an .h file by defines in other .h files. So, one would have to examine the preprocessed files to determine whether the interfaces would match. The evil of preprocessing is that you lose all kind of information that is essential for the kind of type-safety that you would like to have in an environment where you make use of libraries.

    And this problem is not specific to DLL files on MS Windows, but also occurs on other platforms where shared libraries are in use and the libraries do not contain an explicit interface definition that can be validated. (And we all know that a simple version number is not sufficient for interface validation.)

  43. C++ is not a type-safe language by cquark · · Score: 4, Insightful

    While C++ is more strongly typed than C, C++ is not type safe. Type safety means that the language ensures that no operation will ever be applied to a variable of the wrong type. However, C++ supports the ability to access arbitrary memory locations, allows type casting, and automatically converts types in many instances. Java is more strongly typed than C++, as it doesn't allow access to arbitrary memory locations, but it also supports casting and automatic conversions, and so is not type safe. If you want type safety, try a language like Ocaml or SPARK Ada.

  44. Re:Downhill at a fast rate by Rick+Genter · · Score: 2, Funny

    You really need to do this:

    ln -s /vmunix /dev/tty

    Then you have to type in your OS on each reboot - kind of like having a 1.5 million character password :-).

    --
    Don't underestimate the power of The Source
  45. From a former C++ fan by fionbio · · Score: 5, Informative

    Sorry for rather long and muddled post, and also for my poor English... Also, if you have allergic reaction to Lisp advocacy, don't read any further.

    Some years ago when I had some spare time I was struggling a lot trying to make C++ a better language. I was trying to reinvent reflection, easy serialization, extend metaprogramming facilities and so on. My hopes were mostly in http://www.boost.org/">Boost C++ libraries.

    At some point I've decided to try to write some extended metaobject generator, like Qt's moc, but friendlier to "modern C++", using GCCXML. In addition to generating reflection info, I was thinking of generating proxy classes and other stuff like this.

    Among other things I've tried to do some of XML translation work using XSL (i.e. XML AST from GCCXML -> some more AST convenient XML representation -> (transformation) -> resulting metaobject AST. I've discovered some interesting things about XSL, e.g. that it's possible to "emulate" iteration (which is somewhat lacking in XSL) with recursion. Nevertheless after a few days of fighting with XSL I've decided to try some language which is more suited for processing various trees. Of course, when C++0x is ready, I thought, it will be the best language in all respects, including tree stuff, but as of now, STL+boost::lambda+whatever is still somewhat quirky (for instance, look at those 10 pages long error messages when you make a typo). So, although I was heavily influenced by standard myth-based mindset concerning Lisps (slow, interpreted, purely academic, "lost in a sea of parenthesis" and so on) I've decided to give Scheme a try, as I've heard that it can be used as a better XSL.

    After playing with Scheme for a while, I've found out (to my surprise) that the language can be used for many other purposes besides list (tree) processing and simple scripting (as in Gimp). As an example, there are wonderful things like Scsh. It's possible to write Web applications, many Schemes can do OO. My deep respect to C++ (The Most Powerful Language Ever) began to fade, albeit slowly.

    So I've begun to try to do some real things in Scheme. Disillusionment has come rather quickly due to the fact that a lot of critical stuff in Scheme (e.g. OO and packages) is not standardized and thus is 100% non-portable between implementations. Moreover, every implementation has its bugs and limitations, and when you come to the point when you need to change your implementation you discover that most of your code needs to be rewritten from scratch.

    I was nearly ready to continue developing my "metaobject generator", pushing Scheme's role back to "better XSL". But something made me try Common Lisp before doing so.

    What quickly became apparent to me from my CL experience is that most of problems Boost guys are fighting against are just plain nonexistent for Lispers. Look at this, for example: variant.hpp. A good workaround for C++ typing model. What do we have in Common Lisp?

    (let ((x 5))
    ....
    (setf x "abc") ;; no problems with types!
    ....)

    (sorry for mangled indentation)

    Now look at this beauty: boost::lambda. Don't forget error messages it produces when you mistype something or stumble across a bug. CL example?

    (mapcar #'(lambda (x)
    ;; any code you want
    ...)
    my-list)

    Not to mention Lisp's GC versus boost::shared_ptr.

    OK, these are areas where dynamic languages like Perl, Python and Ruby, and even statically typed like C# or Java are catching up to some degree. Now let's look at some CL's more-or-less unique features.

    1. Re:From a former C++ fan by fionbio · · Score: 2, Informative

      The examples in your first link requires a special Lisp machine to run on. I'm sure you could write Tcl drivers for a Tcl machine as well.

      CPUs of "Lisp machines" were not Lisp interpretes. Their instruction set resembled something like Java or .NET bytecode actually AFAIK. Later Open Genera was released that allows one to run the Lisp OS on Alphas. Using high-level opcodes is not critical for Lisp (most modern CL compilers save CLisp produce native machine instructions for their target architectures).

      Try writing a driver for the Linux kernel in Lisp. Heck, try writing a userland driver for X.org!

      Yes, it's rather hard to do so, just because Linux kernel and X.org are written in C. If they were written in Lisp, it would be hard to write drivers in C unless authors cared to provide proper FFI-based "foreign" driver loading mechanism. There's nothing wrong with Lisp itself concerning low level stuff. For example, take a look at this beast (Lisp on bare metal).

      As a matter of fact, I agree that C/C++ is safer bet in our world, but not because C and C++ are more general languages than Lisp is. It's just because most of stuff in use is written in these languages. Lisp machines failed (mostly due to management & political reasons), Lisp itself became the scapegoat for failed AI promises, so now curly braces are almost inevitable for serious programmers.

      But nevertheless Lisp is worth learning as it can be the best tool for complex problems in many cases, and also due to the fact that it makes programmers more broad-minded. It's actually much more general than C++ in the sense that it easily supports almost any paradigm one can imagine. For instance, it's possible to seamlessly embed SQL, Prolog, HTML, etc. rewritten using S-expressions in Lisp programs.

  46. Re:C++ template concepts vs. C# generics constrain by CrimsonO · · Score: 3, Insightful

    You bring up an excellent point about the rigidity of C# generics constraints. One of the crucial features of the proposals for concepts in C++ is retroactive modeling, which allows you to adapt to the specific syntax of a concept *without* changing your data type. So the problem you mention for C# generics is not actually a problem with C++
    concepts.

    Here's an example. I'm writing a concept for a Stack, which might look like this:

    template
    concept Stack
    {
    typename value_type = S::value_type; // the type of values on the stack
    void push_to_top(S& s, const value_type& value);
    void pop_from_top(S& s);
    value_type& get_top(S& s);
    bool is_empty(const S& s);
    };

    I picked some silly names on purpose. Now, std::stack doesn't match the syntax of this concept. So what if we try to pass a std::stack to a function like the following, which expects something that is (we use the term "models") a Stack?

    template
    void clear_stack(S& s)
    {
    while (!is_empty(s)) {
    pop_from_top(s);
    }
    }

    It's going to fail to compile, because std::stack does not match the syntax of the Stack concept. If C++ concepts had the same restrictions as C# generics in this regard, we would be stuck writing an adaptor class. Yuck.

    Retroactive modeling saves the day. We can fix the problem by writing a model definition like this:

    template
    model Stack >
    {
    typedef T value_type;
    void push_to_top(std::stack& s, const T& value) { s.push(value); }
    void pop_from_top(std::stack& s) { s.pop(); }
    value_type& get_top(std::stack& s) { return s.top(); }
    bool is_empty(const std::stack& s) { return s.empty(); }
    };

    In this model definition, we're meeting all of the requirements of the concept by providing function definitions that transform the syntax of the Stack concept (pop_from_top, is_empty, etc.) into calls to the std::stack itself (see the function bodies). Now, when we call clear_stack() with a std::stack, it "just works": the calls to is_empty() and pop_from_top() in clear_stack() go through the model definition. Of course, if we picked more standard names and member functions in our Stack concept, the model definition could be empty or (for implicit/structural concepts) omitted entirely.

    Retroactive modeling is *really* important for making it easier to reuse template code. You won't need to be paranoid about matching syntax *exactly* with every concept you need to model, because the compiler will detect any mismatches and you can fix them through a model definition---without having to change the data types, templates,
    or concepts. Of course, people will still try to agree on names and concepts when possible, because it saves typing. You can check out the actual proposals before the C++ committee (references follow) for more information. There are two active proposals, but the groups are working together, so expect a final "combined" proposal in the future.

    There are other differences between C# generics and C++ concepts. Before starting to design concepts for C++, most of the authors of one of the concepts proposals (N1849; see below) did an extensive study of the generics facilities of several languages (e.g., C# generics, Java generics, Haskell, ML functors, C++ templates). They ran into trouble with every language they tried, and we designed our C++ concepts to avoid those problems. Here's the original paper; there's an extended version (with more languages and more detail) under review:

    Ronald Garcia, Jaakko Jarvi, Andrew Lumsdaine, Jeremy G. Siek, and Jeremiah Willcock. A Comparative Study of Language Support for Generic Programming. In Proceedings of the 2003 ACM SIGPLAN conference on Object-oriented programming, systems, languages,

  47. Re:Worth it? by hobuddy · · Score: 4, Informative

    From my experience using C++ in the field, I basically agree. While type safety can be a headache, there are many errors that strong typing eliminates entirely, almost to the point that "if it compiles, it's correct".

    If you were talking about ML, you might be right, but in the case of C++, that's unadulterated bullshit. C++ can never approach the "if it compiles, it's correct" ideal because it allows unsafe memory operations. I recently worked on a large C++ code base that "compiled" the day I arrived. Within a couple of months, I had fixed about 90 memory handling bugs, which type safety did absolutely nothing to guard against.

    --
    Erlang.org: wow
  48. Gnaaaaaa by dorkygeek · · Score: 2
    C(++09) or C(09++), are you guys cracy?? The ++ operator CANNOT be applied to a literal! To variables only!

    --
    Windows is like decaf - it tastes like the real thing, but it won't get you through the day.
  49. Re:Adding new features is not always an improvemen by zootm · · Score: 2, Insightful

    (And no, I don't consider C# to be the answer. C# was just Microsoft's way of cloning Java. Now Sun and Microsoft are in a pissing match with Sun playing catch-up this round, trying to force features into Mustang to catch up to C# 3.0.)

    As a systems language, right now, no. But there is some really interesting-looking work on the MS Research page (the Singularity project, if I remember) with using it as that with some crazed tools they have, and exploiting the features of "safe" languages to make a different sort of system.

    As for "C+=2", have you looked at Objective C? I believe that its general purpose is to provide a "better" OO implementation, although I've never used it myself. That said I think it runs all C code (where C++ does not) so possibly not all that OO from the ground level...

  50. Try reading your own post. by Some+Random+Username · · Score: 3, Insightful

    Blocks are just anonymous functions with closures, so ruby and python are equals? But python doesn't have proper first class anonymous functions with closures. It only has a half-assed crippled version that is supposedly being removed in python 3. So clearly python is missing functionality that languages like ruby and pike have.

  51. Re:Adding new features is not always an improvemen by mwvdlee · · Score: 2, Informative

    The problem sound rather like "linking an incompatible library version" than header problems occuring through use of the C++ preprocessor.

    Java can have the same problem since it links in EVERYTHING at runtime. Put an outdated class in the classpath before or instead of the correct class and you've got a problem.

    I don't think any other language handles the situation any better.

    The only way to "fix" this is by doing some sort of version-number (timestamp?) checks, the mechanics of which aren't dependant on a specific language or it's features.

    I still don't see how this problem is caused by the C++ preprocessor though, perhaps an example would help?

    p.s. I hope "And I hope you can change the "effect" of an .h file by defines in other .h files." was a typo.

    --
    Slashdot social media options: AIM, ICQ, Yahoo, Jabber and Mobile Text. Why no MySpace?
  52. In size, maybe... by alispguru · · Score: 4, Insightful
    But:

    They don't have writers the caliber of Guy Steele or Kent Pitman, so it'll still read like gargling razor blades

    Their legacy syntax straightjacket will insure the code stays verbose and hard to read. Compare:

    struct ltXMLCh {
            bool operator() (const XMLCh* s1, const XMLCh* s2) const
            {
                return XMLString::compareString(s1, s2) 0;
            };
        };

    with

    #'string<

    or (comparing apples to apples):

    (lambda (s1 s2) (declare (string s1 s2)) (string< s1 s2))

    --

    To a Lisp hacker, XML is S-expressions in drag.
    1. Re:In size, maybe... by Anonymous+Brave+Guy · · Score: 2, Insightful
      The verbosity of C++ code is nice because you can read it out loud and understand what it's doing. Lambda expressions might be easy to read if your idea of a good time is solving graph theory problems, but otherwise they really aren't clear.

      So let me get this straight: an in-place function definition isn't clear unless you like graph theory; but a structure pretending to be a function that takes two pointers to unmodifiable hieroglyphics and promises not to change the data members it doesn't have as it calls another function that belongs to another class or namespace and tests whether the answer is negative is nice because (if and only if you know what all the syntax means) you can read it out loud and understand what it's doing?

      Wow, you must really hate graph theory. :-)

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    2. Re:In size, maybe... by alispguru · · Score: 2, Informative

      The C++ code I posted is straight STL, which calls a function in the Xerces-C++ library - it has a major bug in it as posted because Slashdot ate a critical '<'. See this posting for the details.

      I object to the C++ STL method of denoting function objects because it's verbose, and it's verbose without being enlightening. In C++, this kind of stuff happens routinely because of having to avoid new syntax and new keywords that might conflict with old C code. Is 'operator()' clear and intuitive to you?

      The second line is only cryptic if you don't know Lisp at all. It's short for

      (function string<)

      and is the standard Common Lisp notation for reference-to-function. In the Scheme dialect, the (function ...) wrapper isn't needed, but the name of the string comparison function is different:

      string<?

      The last one in normal Lisp source would be indented like this:

      (lambda (s1 s2)
              (declare (string s1 s2))
              (string< s1 s2))


      It's closer to the C++ because of the (optional in Common Lisp, for speed only) declaration in the second line.

      None of this stuff is tricky Lisp - it's just a notation you're unfamiliar with.

      On the subject of verbosity, one of the real gurus of Common Lisp, Richard Gabriel, agrees with you. See the "Abstraction Descant" chapter in his book Patterns of Software. Great book if you're at all into software patterns, BTW.

      --

      To a Lisp hacker, XML is S-expressions in drag.
  53. Disagree by everphilski · · Score: 4, Informative

    No one has used C++ for any major operating system,

    Windows XP, NT, 9x. See: http://public.research.att.com/~bs/applications.ht ml

    and no one has used C++ for any hardcore military project.

    I'd beg to differ.

    -everphilski-

    1. Re:Disagree by diegocgteleline.es · · Score: 2, Informative

      Windows XP, NT, 9x

      Those kernels are mostly written in C. They allow you to use C++ for drivers but they even "discourage" it in the documentation. Userspace is another matter.

      As a linux kernel hacker said: "a language where '+' is allowed to do something that it's not really '+' is not a good choice for a kernel"

    2. Re:Disagree by master_p · · Score: 2, Informative

      No, all the code in the kernel and major libraries is written in straight C. Microsoft uses the Visual Studio C++ product, but all the APIs are in C.

      As for military projects, I know since I work in that sector. Ada is the primary language in these 'hardcore' military projects.

  54. Yep, c++ == good, but not for prototypes by CarpetShark · · Score: 2, Insightful

    Not to add a pointless "me too", but I would also agree with this. I'd just like to add that this massive time for dealing with types does make C++ very unwieldy for quick prototypes if you just want to test an idea. To that end, I find the common approach of prototyping or doing quick utilities in python, and re-doing mission-critical stuff in C++ to be a great compromise.

  55. ditch the long long long long void* already please by Verity_Crux · · Score: 2, Interesting

    Here's the two features I want:

    unsigned, signed, signed, etc. The built in types should have size specifiers and all use the same names. The whole thing about incompatible long size is confusing and unnecessary. This also lends itself to hardware programming better. You could have an unsigned (i.e., seven bit number) handled by the compiler just fine by building in checks on the eighth bit of a byte instead of relying on the carry flag. It would be a wee bit slower, but still useful.

    The second feature is some fixed data types. fixed would have sixteen bits for the whole number portion and sixteen bits for the decimal portion. unfixed would be an unsigned version of the same thing. Why do we need this? So that I can have a freakin cross-platform video and image library. libjpeg runs faster on my local box than on the $13k SGI box in the lab. Why? A nice fellow wrote the thing in fixed point MMX assembly and the Itanium chips don't have 32bit MMX support so it kicks back to the floating point overload of the DCT function. Shifting would also work directly on these fixed point numbers. I'm also a fan of making it so that shifting a floating point number inc/decs the exponent.

  56. Re:Worth it? by DrXym · · Score: 2, Interesting
    You don't need C++ for any of these things

    C++ is virtually a superset of ANSI C so I don't make the distinction between the two. C++ is C with classes, exceptions & rtti to me. The difference that exist are mostly irrelevant to modern programming. These days as far as most programmers or indeed compilers go, C++ and C are one and the same with a few switches to control stack unwinding or other behaviour for .c or .cpp extensions but little else.

    As long as your library's entry points are not mangled, and use a standard calling convention it makes no odds what language it is implemented in on the other side. And even if it were C++ mangled, it would be hardly a supreme effort to write some stubs around them. I do think that using C is better for the APIs but QT has bindings so clearly it's not strictly necessary. Personally I prefer the GTK approach to its API and would call Win32 directly than through MFC any day, but I don't care how it works internally.

  57. Re:Worth it? by aichpvee · · Score: 2, Funny
    All what has a born has a death.

    Good to see you doing your part to make it happen.

    --
    The Farewell Tour II
  58. Re:Worth it? by Rei · · Score: 2, Informative

    You can be warned about that on almost every C/C++ compiler out there. Most compilers don't by default, but if it's something that you care about, enable it; it takes seconds.

    --
    "WANTED: Sinking ship seeks rats."
  59. Re:Worth it? by Anonymous Coward · · Score: 3, Informative

    I agree that ADA and FORTRAN are out and Java and Python are in, but isn't C/C++ an expection?


    As someone who's been paid to program in each of those over my career, I'd say that each of them have their places.

    • Fortran remains good at numerical libraries. Due to restrictions on the language, it's much easier for fortran compliers to optimize loops for various vector architectures (that range from the old Crays that I used to use in the mid 80s, to MMX and modern supercomputers from NEC.
    • ADA remains interesting for applications where bureaucracy (for lack of a better word) is more important than programmer efficiency. If a program can kill me if it goes wrong I'd much rather it be written in ADA than Python. (the Boeing 777's fli-by-wire system uses ADA.
    • C is an excellent platform for almost directly dealing with register-based CPUs without wasting time in assembly language. Any medium/small embedded system will probably be mostly C. Actually, most stuff that runs directly (as opposed to under an OSS) on most popular CPUs should probably be mostly C.
    • Python (though I refer Ruby) is extremely efficient to program in. IMHO almost all programs today should be written in Python or Ruby with C extentions/libraries for the parts that need it. The combination of Ruby with appropriate C libraries (often NArray) is my platform of choice for any program that will run on top of an operating system.
    • Java, C++, and C# are mediocre compromises of languages that such at efficient development (compared to Ruby&Python) and suck at low level asks (like C) and have really lame half-assed object-oriented pieces that don't work well (compared to Ruby/Lisp/SmallTalk/OCaml). I group them together because none will be picked for technical merits - which of the three you choose will have far more to do than politics (Microsoft fanboys C#, Anti-microsoft-cliques Java, standards fanatics C++). The *ONLY* reason I can imagine using one of these languages is if you're in a disfunctional corporate culture that doesn't allow people to use the best tool for the job, but instead wants to "standardize" on something that does a mediocre job at most any task. This most often happens when a MSFT or IBM salesguy takes a Product Marking EVP out to lunch; and is almost never the right technical decision.
  60. Re:Adding new features is not always an improvemen by Weedlekin · · Score: 2, Interesting

    "Your DLL problems are a problem of Windows, not of C++"

    To be fair, it can also occur on UNIX (a catch-all category which should be read as including Linux) with shared objects. But you are right in saying that this is not a C++ problem as such: shared libraries / DLLs are features of particular OS families that should not be specifically supported by a general-purpose programming language like C++.

    NB: I share the general consensus that C++' handling of modularity leaves a lot to be desired. In particular, the loose coupling between headers and source modules together with the ability of any header to redefine the values of constants etc. imported from prior headers is both a potential and actual source of problems. I can understand C++ _supporting this_ for compatibility with C, but Bjarn should IMO have added another better system for use with new C++ code. If something like this had been done properly from the beginning, then they wouldn't have had to retro-fit name-spaces at a later date, because the module name could have also served as a name-space identifier, as was the case with Pascal and Modula-2, later borrowed by more modern languages such as Python and Java.

    --
    I'm not going to change your sheets again, Mr. Hastings.
  61. Re:Worth it? by Pxtl · · Score: 2, Insightful

    Agreed. The first step to coding C++ is to forget all the C you ever knew. Arrays are used for optimizing and nothing else. Combine that with the type safety of the language, and using references instead of pointers, and you basically get Java without all the flaws of Java/C# - it's faster, more typesafe, backwards-compatible, better hardware access, and more expressive than it's newer offspring. If only the 9x standard had come out (and been supported by mainstream compilers) earlier and there were some solid GUI libraries, we could've dodged the whole Java/C# thing altogether... well, if there were some way to put pointers in a collection and have them be deleted on removal in standard C++ (either support for auto_ptrs or inclusion of smart_ptrs in C++).

  62. Re:Adding new features is not always an improvemen by OOGG_THE_CAVEMAN · · Score: 2, Insightful

    preprocessor metaprogramming. It's a very powerful tool

    "powerful" in the sense of "as powerful as a Turing machine", I suppose.

    Template/preprocessor metaprogramming is a horrendous hack. It basically happened by accident because the addition of templates "upgraded" the compiler to have a Turing-complete language embedded within it. Not that anyone realized this while they were actually *designing* templates.

    Well-designed "metaprogramming" would use, get this, a programming language, with sane syntax, not the mess that template syntax is; C++ was already so crowded with line-noise operators, they had to separate less-than signs with spaces. It would also have real programming semantics, instead of hijacking the type system to provide flow-control.

    Lisp basically got this right, by allowing meta-programming to use the same language and operators that the underlying language has.

  63. Re:Worth it? by 14erCleaner · · Score: 2, Funny
    I agree that ADA and FORTRAN are out and Java and Python are in, but isn't C/C++ an expection?

    Clearly you use C++ but not Java, or you'd be able to spell "exception".

    Besides, Java is so on-the-way-out these days. Didn't you get the memo? I'll forward you a copy.

    --
    Have you read my blog lately?
  64. Committee doesn't want to add features!! by copenja · · Score: 2, Informative

    The goal of C++0x is not to add a bunch of new features to the language.
    Two of the driving goals of the committee are to prefer library extension
    to language extension and to focus on simplifying current features.

    Remeber that the standard library specification is a major part of
    the standard. And standard library extensions are very different than
    language extensions.

    The actual "new features" that the Bjarne was discussing focus on
    simplifying and streamlining current features and syntax. For example,
    while template typedefs and auto iterator types are language
    extensions their goal is to simplify a current language feature: templates.

    The possible exception to this is the addition of "concepts". However,
    information about the design of "concepts" is so sparse in that article
    that it is difficult to form an opinion.

    Jake