Slashdot Mirror


The Future of C++ As Seen By Its Creator

holden writes "In a rare public talk, C++ creator Dr. Bjarne Stroustrup discusses his ideal in programming languages, as well how he sees the next version (and beyond) of C++ developing. He explains the general selection criteria used for adding new features, some of the legacy of C++, and many other interesting topics. Especially interesting is during the Q&A he explains his views of the embrace and extend mentality some implementations, such as VC++, have taken."

424 comments

  1. uh... by cosmocain · · Score: 4, Insightful

    ...transcript, anyone? i hate watching or listening to vids at work.

    1. Re:uh... by neonmonk · · Score: 4, Funny

      Agreed. I don't see the point in video unless they're actually showing up some fancy technology. ...Or, alternatively, they've got really nice jugs.

    2. Re:uh... by badran · · Score: 0

      You can always tell your boss, this is an instruction video. And that this would make your a much better programmer.... This might work... or you will get fired for reading too much /.

    3. Re:uh... by LiquidCoooled · · Score: 5, Funny

      Good afternoon everybody, I would like to start by including iostream.h into the discussion.

      After this we can get onto the main proceedings which might or might not return anything.

      We move to the future by emitting a string of "Hello world" before returning zero.

      This is the end of the discussion I hope it was informative.

      --
      liqbase :: faster than paper
    4. Re:uh... by jrumney · · Score: 1

      I don't mind watching videos at work, but at 101 minutes long, and with all of slashdot hitting it right now ... rebuffering 1% ..., I don't think I'll be watching this one.

    5. Re:uh... by pigscanfly.ca · · Score: 1

      Did you notice the bittorrent links? you can set it to download and come back to it later.

    6. Re:uh... by Pseudonym · · Score: 5, Insightful

      Good afternoon everybody, I would like to start by including iostream.h into the discussion.

      That ruined the joke for me. Like Stroustrup would ever include the legacy non-namespaced header!

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    7. Re:uh... by Anonymous Coward · · Score: 0

      Not past two.
      Now, if you throw in sculptable gut-folds and fake nipples, you could get into double digits on some models.

    8. Re:uh... by smittyoneeach · · Score: 2, Funny

      Stroustrup is an academic. Blowing by petty details for pedagogical reasons is a time-honored device.

      --
      Get thee glass eyes, and, like a scurvy politician, seem to see things thou dost not.--King Lear
    9. Re:uh... by larry+bagina · · Score: 5, Funny

      exception: slashdot editors.

      --
      Do you even lift?

      These aren't the 'roids you're looking for.

    10. Re:uh... by Odin's+Raven · · Score: 5, Funny

      Good afternoon everybody, I would like to start by including iostream.h into the discussion.

      That ruined the joke for me. Like Stroustrup would ever include the legacy non-namespaced header!

      I'm sure he only did that to ensure compatability with older members of the audience.
      --
      A marriage is always made up of two people who are prepared to swear that only the other one snores.
    11. Re:uh... by Mr.+Underbridge · · Score: 4, Funny

      I'm sure he only did that to ensure compatability with older members of the audience.

      Then the joke should have been in COBOL.

    12. Re:uh... by cerberusss · · Score: 5, Funny

      Here ya go, buddy.

      Interviewer: Well, it's been a few years since you changed the world of software design, how does it feel, looking back?

      Stroustrup: Actually, I was thinking about those days, just before you arrived. Do you remember? Everyone was writing 'C' and, the trouble was, they were pretty damn good at it. Universities got pretty good at teaching it, too. They were turning out competent - I stress the word 'competent' - graduates at a phenomenal rate. That's what caused the problem.

      Interviewer: Problem?

      Stroustrup: Yes, problem. Remember when everyone wrote Cobol?

      Interviewer: Of course, I did too

      Stroustrup: Well, in the beginning, these guys were like demi-gods. Their salaries were high, and they were treated like royalty.

      Interviewer: Those were the days, eh?

      Stroustrup: Right. So what happened? IBM got sick of it, and invested millions in training programmers, till they were a dime a dozen.

      Interviewer: That's why I got out. Salaries dropped within a year, to the point where being a journalist actually paid better.

      Stroustrup: Exactly. Well, the same happened with 'C' programmers.

      Interviewer: I see, but what's the point?

      Stroustrup: Well, one day, when I was sitting in my office, I thought of this little scheme, which would redress the balance a little. I thought 'I wonder what would happen, if there were a language so complicated, so difficult to learn, that nobody would ever be able to swamp the market with programmers? Actually, I got some of the ideas from X10, you know, X windows. That was such a bitch of a graphics system, that it only just ran on those Sun 3/60 things. They had all the ingredients for what I wanted. A really diculously complex syntax, obscure functions, and pseudo-OO structure. Even now, nobody writes raw X-windows code. Motif is the only way to go if you want to retain your sanity.

      Interviewer: You're kidding...?

      Stroustrup: Not a bit of it. In fact, there was another problem. Unix was written in 'C', which meant that any 'C' programmer could very easily become a systems programmer. Remember what a mainframe systems programmer used to earn?

      Interviewer: You bet I do, that's what I used to do.

      Stroustrup: OK, so this new language had to divorce itself from Unix, by hiding all the system calls that bound the two together so nicely. This would enable guys who only knew about DOS to earn a decent living too.

      Interviewer: I don't believe you said that...

      Stroustrup: Well, it's been long enough, now, and I believe most people have figured out for themselves that C++ is a waste of time but, I must say, it's taken them a lot longer than I thought it would.

      Interviewer: So how exactly did you do it?

      Stroustrup: It was only supposed to be a joke, I never thought people would take the book seriously. Anyone with half a brain can see that object-oriented programming is counter-intuitive, illogical and inefficient.

      Interviewer: What?

      Stroustrup: And as for 're-useable code' - when did you ever hear of a company re-using its code?

      Interviewer: Well, never, actually, but...

      Stroustrup: There you are then. Mind you, a few tried, in the early days. There was this Oregon company - Mentor Graphics, I think they were called - really caught a cold trying to rewrite everything in C++ in about '90 or '91. I felt sorry for them really, but I thought people would learn from their mistakes.

      Interviewer: Obviously, they didn't?

      Stroustrup: Not in the slightest. Trouble is, most companies hush-up all their major blunders, and explaining a $30 million loss to the shareholders would have been difficult. Give them their due, though, they made it work in the end.

      Interviewer: They did? Well, there you are then, it proves O-O works.

      Stroustrup: Well, almost. The executable was so huge, it took five minutes to load, on an HP workstation, with 128MB of RAM. Then it ran like treacle. Actually, I thought this would be a majo

      --
      8 of 13 people found this answer helpful. Did you?
    13. Re:uh... by allthingscode · · Score: 0

      And God has been kicking himself in the ass every day for creating English at Babel. Why in the hell do you need both restful and restless to mean the same thing? One million words in a language? Reduce the language to just one word for everything and you'll be fine.

      Maybe you should make the use everything in the language to write a program a part of your job interview questions. As for remembering whether stuff is dereferenced or not, I didn't find it to be any trouble. Look at what java and C# have gone through: java had to introduce clunky wrapper classes, but since they don't allow operator overloading, you have to know whether you are dealing with an int or Integer and whether to write .add() or +. C# added "ref", but that's no different than C++.

    14. Re:uh... by Sax+Maniac · · Score: 1
      --
      I can explanate how to administrate your network. You must configurate and segmentate it, so it can computate.
    15. Re:uh... by tepples · · Score: 1

      Did you notice the bittorrent links? you can set it to download and come back to it later. Not everybody who is on break at work has an always-on home server that runs a torrent client with a web gateway. Heck, not everybody lives in the service area of a broadband ISP that allows such behavior on residential accounts.
    16. Re:uh... by StarReaver · · Score: 3, Funny

      Reduce the language to just one word for everything and you'll be fine. If there were only
      One word per definition
      Haiku would be dull.
    17. Re:uh... by afidel · · Score: 2, Insightful

      As someone who's used C++ since it was a collection of precompiler directives I LOL'd, but you really should give credit to the original author.

      --
      There are 4 boxes to use in the defense of liberty: soap, ballot, jury, ammo. Use in that order. Starting now.
    18. Re:uh... by Otter · · Score: 2, Insightful
      Why in the hell do you need both restful and restless to mean the same thing?

      They don't remotely mean the same thing. (Putting aside that you then go on to demand that more words mean the same thing.)

    19. Re:uh... by cerberusss · · Score: 4, Informative

      This thing's been forwarded around the net without the original author attached. However, I think I tracked it down to cddukes@unity.ncsu.edu... Any readers correct me if I'm wrong.

      --
      8 of 13 people found this answer helpful. Did you?
    20. Re:uh... by kestasjk · · Score: 1

      It's dead slow at the moment, even to get the torrent. Here it is

      --
      // MD_Update(&m,buf,j);
    21. Re:uh... by Surt · · Score: 2, Informative

      http://mw1.merriam-webster.com/dictionary/restful
      1 : marked by, affording, or suggesting rest and repose
      2 : being at rest : quiet

      http://mw1.merriam-webster.com/dictionary/restless
      1: lacking or denying rest : uneasy
      2: continuously moving : unquiet
      3: characterized by or manifesting unrest especially of mind ; also : changeful, discontented

      --
      "Who is the Journal of Quantum Physics going to believe?" --Stephen Hawking
    22. Re:uh... by epee1221 · · Score: 4, Funny

      Reduce the language to just one word for everything and you'll be double-plus good!

      --
      "The use-mention distinction" is not "enforced here."
    23. Re:uh... by Hoi+Polloi · · Score: 2, Funny

      I skipped that meeting when I saw it was void. Can't get anything out of those things.

      --
      It is by the juice of the coffee bean that thoughts acquire speed, the teeth acquire stains. The stains become a warning
    24. Re:uh... by djw · · Score: 2, Informative

      restful and restless
      I think you mean restive and restless. But they don't mean quite the same thing.
    25. Re:uh... by allthingscode · · Score: 1

      Thanks, yeah, I meant restive, I was trying to get out the door when I wrote that one.

    26. Re:uh... by Anonymous Coward · · Score: 5, Funny

      COBOL is already a joke.

    27. Re:uh... by zippthorne · · Score: 1

      I'd have gone for the low hanging, "inflammable" route. Funny rant, though.

      --
      Can you be Even More Awesome?!
    28. Re:uh... by Vampyre_Dark · · Score: 1

      Actually, Stroustrup is a phoney. Everyone knows Al Gore invented C++!

    29. Re:uh... by Anonymous Coward · · Score: 0

      I'm sure he only did that to ensure compatability with older members of the audience.
      Then the joke should have been in COBOL.


      Whoo there, he only mentioned legacy

    30. Re:uh... by garoo · · Score: 2

      Reduce the language to just one word for everything and you'll be fine.

      Linguistics is way ahead of you here...

      "I'm a linguist. My job is to make communication simpler. I invented a language with no grammar, no syntax, no ambiguities. In fact, it had only one word: CHICKEN."

      Also note the recently published paper on this topic, "Doug Zongker, "Chicken Chicken Chicken: Chicken Chicken", Annals of Improbable Research, 12(5) September-October 2006, 16-21, and the associated presentation.

      I don't know where linguists get their ideas from but I wish I had a supplier :-P

    31. Re:uh... by Anonymous Coward · · Score: 0

      Try this. The Labs crew often didn't see eye to eye.

    32. Re:uh... by Anonymous Coward · · Score: 0
      Not everybody who is on break at work has an always-on home server that runs a torrent client with a web gateway.

      Well then, until you get home you could maybe do some work or something. You know, to pass the time.

    33. Re:uh... by Boronx · · Score: 1

      "There are no synonyms in the English language."

    34. Re:uh... by Anonymous Coward · · Score: 0

      iostream.h is deprecated

  2. Embedded video? no thanks by JosefAssad · · Score: 2, Funny
    At least we won't get any "RTFA, moron!" comments in this article.

    But seriously, I like slashdot because, unlike digg, we get ARTICLES, not videos. I'm not watching this. In protest, here's a completely misinformed and irrelevant comment which extrapolates a lot of very outlandish conclusions from the article summary:

    Stoustrup just wants to make sure VC++ doesn't eat into the market share of his new linux-powered RC car, CTTOX. He has been embracing and extending C ofr many years now; if congress weren't so impeachment-obsessed, they would have slapped him with anticompetitive sanctions. What is a doctor doing talking about languages anyhow, he should leave that to linguists like Alan Cox and stick to paediatric medicine.

    Or, to rephrase, give me text links or give me fatal and catastrophic loss of message and meaning

    1. Re:Embedded video? no thanks by archeopterix · · Score: 1

      At least we won't get any "RTFA, moron!" comments in this article.
      Time to upgrade to VTFA.
    2. Re:Embedded video? no thanks by Anonymous Coward · · Score: 0

      View the fuckin article? That's okay, but I like WTFV: watch the fuckin video better.

    3. Re:Embedded video? no thanks by neonmonk · · Score: 3, Funny

      Don't you mean WTFV?

  3. Mod Parent Insightful by dreamchaser · · Score: 5, Insightful

    Video or audio just for the sake of being flashy is a dumb idea and I usually won't watch or listen. If I want audio and video I'll devote my full attention to my TV feed. Otherwise when I'm accessing information on the Internet I want text. I can read it far faster than someone speaks on a video interview for one thing, and for another text lends itself far better to (human)multitasking than video or audio does.

    1. Re:Mod Parent Insightful by Joe+Tie. · · Score: 1

      Agreed. Audio/Video presentations of what could be run through much faster as a simple webpage or pdf is becoming increasingly common and annoying. Hearing people talk about code is like listening to the audio of a person making balloon animals.

      --
      Everything will be taken away from you.
    2. Re:Mod Parent Insightful by Yvanhoe · · Score: 1

      Plus, it is more difficult for a non native speaker to understand than a written text.

      --
      The Wise adapts himself to the world. The Fool adapts the world to himself. Therefore, all progress depends on the Fool.
    3. Re:Mod Parent Insightful by edittard · · Score: 1

      And you can't print it off ansd read it on the train.

      --
      At the bottom of the /. main page it says 'Yesterday's News'. Well they got that right.
    4. Re:Mod Parent Insightful by nschubach · · Score: 3, Funny

      i cumpleetly understand wut ur sayin. its much esyer to reed things on teh internets than it evar wuz be4.

      --
      Every time I start to have faith in humanity, I ruin it by driving to work between 7 and 8 am.
    5. Re:Mod Parent Insightful by MightyYar · · Score: 1, Insightful

      Flashy and dumb? It was a lecture! A transcript does not magically exist - someone has to create it. Unless you are willing to transcribe the lecture into text and make it available, you sound pretty hypocritical complaining that someone has taken the effort to make the existing format accessible by Flash, Xvid, Ogg, MP4, and MPG through both BitTorrent and via HTTP. Christ, even my Palm can play several of those formats!

      The Internet is not for "text", it is for data.

      --
      W..w..W - Willy Waterloo washes Warren Wiggins who is washing Waldo Woo.
    6. Re:Mod Parent Insightful by Anonymous Coward · · Score: 0

      I'm sorry, I didn't quite catch that. Could you repost it, in English?

  4. In other news. by Anonymous Coward · · Score: 3, Funny

    The future of BASIC has been envisioned as a language to do more and more intricate beeping loops in high school classes.

  5. but... by daddyrief · · Score: 1

    what about extinguish? jk, i love visual studio... (there actually are some nice features, imo.)

    --
    "Banking establishments are more dangerous than standing armies." -Thomas Jefferson
  6. Next version? by tygerstripes · · Score: 4, Funny

    Great - I've been hearing a lot about C-Pound.

    --
    Meta will eat itself
    1. Re:Next version? by nagora · · Score: 1
      Great - I've been hearing a lot about C-Pound.

      Do you mean C-hashed?

      --
      "Encyclopedia" is to "Wikipedia" what "Library" is to "Some people at a bus stop"
    2. Re:Next version? by netpixie · · Score: 2, Insightful

      That's a weird article.

      Why is this candidate "bad" because he interprets a piece of marketing twaddle (i.e. the name of C#) in a different way from Bill?

      Round here we (mostly) purposefully call things the wrong name, usually as an exclusive in-joke because we all really know what the real term is meant to be. This includes Giga- pronounced "jigga-" and internet called "interweb" or "interwebnets". My favourite is referring to C# as "coctothorpe" as the proper name for the # symbol is octothorpe. I also used to call C++ "C double plus" as "plus plus" just sounds so ugly (and I'd just finished reading 1984 when I started programming).

      This candidate may be useless for other reasons (and it looks like he is), but calling a silly programming language with a silly name something silly shouldn't be held against him.

    3. Re:Next version? by smittyoneeach · · Score: 1
      --
      Get thee glass eyes, and, like a scurvy politician, seem to see things thou dost not.--King Lear
    4. Re:Next version? by nwbvt · · Score: 3, Interesting

      Well for starters, your pet name for a programming language is not something you should continuously use while in a job interview. Basically what it tells the interviewer is that you really have very little experience with it, and probably have never heard it spoken before.

      --
      Mathematics is made of 50 percent formulas, 50 percent proofs, and 50 percent imagination.
    5. Re:Next version? by Calinous · · Score: 1

      No, but refering to C Sharp in front of him, and he telling he really prefers C-Pound could make a clue.
            Would you say, when asked about C-Sharp in an intervew: "Well, if you're going to talk about the language I'll just write with if I want to be comfortable, it's coctothorpe."

    6. Re:Next version? by Otter · · Score: 1
      Well for starters, your pet name for a programming language is not something you should continuously use while in a job interview. Basically what it tells the interviewer is that you really have very little experience with it, and probably have never heard it spoken before.

      I'm not sure why you got modded down so vigorously for this. It's "redundant" in the sense that it should be obvious to any socially functional human being, but it still seems to be news here.

    7. Re:Next version? by jandrese · · Score: 1

      I used to know a big OS/2 fan that I could always annoy by referring to it as "half os".

      --

      I read the internet for the articles.
  7. Torrents of vid available by Anonymous Coward · · Score: 4, Informative

    Please use the torrents, and keep those torrent up and running after you're done d/l'ing.

    http://csclub.uwaterloo.ca/files/stroustrup.ogg.to rrent Ogg/Theora (Recommended)
    http://csclub.uwaterloo.ca/files/stroustrup.avi.to rrent XviD
    http://csclub.uwaterloo.ca/files/stroustrup.mp4.to rrent MP4
    http://csclub.uwaterloo.ca/files/stroustrup.mpg.to rrent MPEG

    AC to prevent karma whoring.

    1. Re:Torrents of vid available by Anonymous Coward · · Score: 0

      Why should we ENCOURAGE video interviews when text transcripts are so much better suited to this type of discussion?

      BOYCOT VIDEO INTERVIEWS NOW.

    2. Re:Torrents of vid available by hr.wien · · Score: 1

      It's not a video interview, it's a presentation he held that just happened to be filmed and put online. I'm sure someone will write up a transcript for you eventually if you're that bloody fussy, but I'd rather watch the presentation as it was held now.

  8. The problem with VC++ by PhrostyMcByte · · Score: 5, Insightful

    Is that they have given 95% of the development time toward managed languages.

    If you look at the new Visual Studio 2008 - in the three years since 2005 was released, what does Orcas have for C/C++? Still no C99, with open admission that there are no plans to support it. No TR1 for C++. No significant compiler changes. Intellisense is still slow and quite easily stops working all together. Still no assembly support in the 64-bit compiler, missing intrinsic functions for important instructions such as CMPXCHG16B.

    What we get is a newer bundled Windows SDK (which you can download NOW), updated MFC libraries (yuck), and a few new options for Vista compatibility.

    In three years, .NET has advanced from 2.0 to 3.5 with huge changes like WPF, WCF, LINQ, etc. They have all but forgotten C++.

    1. Re:The problem with VC++ by Constantine+XVI · · Score: 1

      Hmmm... Those tactics don't sound familiar at all. Definitley nothing Microsoft's ever done *coughNetscapecough*

      --
      "I think an etch-a-sketch with an ethernet port would beat IE7 in web standards compliance."
    2. Re:The problem with VC++ by mwvdlee · · Score: 1

      Despite Mono's best efforts, .NET is still largely a Windows lock-in feature.
      Now why would Microsoft abandon alternatives to that?

      --
      Slashdot social media options: AIM, ICQ, Yahoo, Jabber and Mobile Text. Why no MySpace?
    3. Re:The problem with VC++ by Jugalator · · Score: 4, Informative

      This discussion came up again with Visual Studio 2008 "Orcas" and plans seemingly a bit lacking once again for an improved C++ feature set and general love for IntelliSense, etc.

      Microsoft had the following to say:
      http://forums.microsoft.com/MSDN/ShowPost.aspx?Pos tID=970938&SiteID=1

      See bdunlap's response.

      --
      Beware: In C++, your friends can see your privates!
    4. Re:The problem with VC++ by Jugalator · · Score: 1

      Forgot one thing. Although the topic is on C++/CLI (formerly called "Managed C++"), I'm not being stupid and confusing it with native C++, but the MS rep is actually saying a few things on their futre "native vs managed" strategy. In essence, they've listened and hear the demand. Not much to come for Orcas, but more in store for the version after.

      --
      Beware: In C++, your friends can see your privates!
    5. Re:The problem with VC++ by rbanffy · · Score: 2, Informative

      It's clear that Microsoft is not interested in the future of C++.

      They more or less own the market for C# and IDEs for .NET. Why would they still be interested in something that could be used to migrate away from Windows?

      BTW, it's really hard to migrate a Windows C++ program away from Windows. A Windows C++ program may be legal C++, but is something horridly deformed and barely recognizable.

    6. Re:The problem with VC++ by Anonymous+Brave+Guy · · Score: 4, Insightful

      If you look at the new Visual Studio 2008 - in the three years since 2005 was released, what does Orcas have for C/C++?

      I'll see you VC++ 2008 and raise you VC++ .Net (aka VC++ 7.0, aka the 2002 release).

      The sad thing is, from a pure C++ programmer's point of view, a lot of people still regard VC++ 6 as the peak. Sure, the standards compliance is better now, and that's a real improvement. Sure, there have been a few optimisation improvements, and those are worthwhile (when they don't introduce bugs). Sure, the debugger has better visualisation support (autoexp.dat) even for native code, and that's definitely useful (if only they'd document it properly).

      But when they moved to .Net for everything, the IDE slowed down horribly, even without the Intellisense/multi-threading mess that they finally fixed in 2005SP1. Certain features (I'm looking at you, browse toolbar) actually disappeared from VC++, for the rather poor reason that they couldn't be supported in all .Net languages. I understand that the whole unified architecture thing makes sense from a development perspective at Microsoft, but the bottom line is that users don't care, and removing useful functionality is bad. I also appreciate that, several versions later, we now have most of the same basic functionality back again, but it's still a mess compared to the simple, effective browse toolbar. Similar comments apply to various being-too-clever changes to Intellisense, incidentally.

      Perhaps more seriously, as great as all these new optimisations are, we've found far more compiler bugs recently than we ever used to. We write serious mathematical libraries at work, and I promise you it is not fun to spend several days tracking down a bizarre floating point problem, because it turned out that the global optimiser got it wrong fifteen functions up the call stack and now the FPU stack is overflowing.

      Meanwhile, we get to see Microsoft putting lots of goodies in for .Net developers. I'm sure they'd love us all to develop for .Net, but until they support it on seven different platforms (where all versions of "Windows" are grouped together as just one of those), it's never going to be of much interest to us.

      Right now, Visual C++ is still (in my personal opinion) the best C++ compiler/IDE combination available today. But things move fast in software. Code compiled with g++ has lagged in performance for a long time, but if the recent work behind the scenes on things like SSA bears fruit, that performance gap could close very fast. Eclipse/CDT is so clunky as to be almost unusable for C++ development right now (don't flame me, it's just a personal opinion) but I check every now and then to see how things are going and it sounds like someone might be planning a big clean-up so it doesn't feel like C++ forced into a Java-friendly IDE any more. With Microsoft pushing all their funky new UI support into things like WPF that almost no-one uses, and portable GUI toolkits like wxWidgets and Qt becoming better all the time, it's not like having MFC support is a great bonus for new developments anyway.

      In other words, if VC++ 2008 doesn't deliver real improvements for non-.Net-only C++ developers, it's entirely possible that the serious players will be switching to genuinely better open source alternatives for new developments well before the next version of VC++ is out. And that should scare Microsoft, because the superiority of VC++ and the ease of use of VB are the reason so many people have been making effectively Windows-only software for so long.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    7. Re:The problem with VC++ by Blakey+Rat · · Score: 2, Insightful

      Good. I think languages with some kind of automatic memory management are the future and make development easier for software houses, which in turn gives them more time worrying about issues like, "will my grandma be able to use this software?" and less time worrying about issues like, "why does it crash when this pointer is dereferenced!?"

      Not that I have anything against C or C++, but for applications (i.e. anything made by Visual C++) I don't think it's an ideal language. We've (as an industry) wasted too much time getting it working with a modern GUI environment already, let's move on. Make fun of VB or C#, or even Obj-C/Cocoa if you want, but all those languages are designed, and excel, for GUI software development.

    8. Re:The problem with VC++ by spectrokid · · Score: 2, Informative

      intrinsic functions for important instructions such as CMPXCHG16B
      You know you have a sucky language when your important function is called CMPXCHG16B (not to be mistaken with that other little SOB, the good ole CMPCHXG16B)
      --

      10 ?"Hello World" life was simple then

    9. Re:The problem with VC++ by nschubach · · Score: 1

      I swear to you this day and forever forward. If I ever work with you and you use "LINQ" in your program, I will rip your cold dead heart out of your chest with a rusty spatula and feed it to baby otters.

      --
      Every time I start to have faith in humanity, I ruin it by driving to work between 7 and 8 am.
    10. Re:The problem with VC++ by gbjbaanb · · Score: 1

      True.. to a point. The thing is that no language is perfect for all situations, and instead of having some focus to a language, MS is positioning C# as the be-all for everything. If they had these managed languages for GUI development, and C++ for back-end efficiency then I'd be very happy as you'd get the best of both worlds. (in the past I used to do all my GUI work in VB that used C++ COM objects for the heavy work, not only was this best use of resources at the time, but the code separation made the entire app much more maintainable (ie you simply couldn't write nasty monolithic apps where everything was spaghetti'd together) and scalable (making it 3-tier suddenly became quite easy).

      Automatic memory management is all well and good, but don't forget that a GC only collects memory, you still have to handle any object cleanup yourself and if the language doesn't have good support for that (IDisposable is a user-coded design pattern not a language feature) than you're getting a langauge that is more a bodge than something that is elegantly object-orientated).

    11. Re:The problem with VC++ by gbjbaanb · · Score: 1

      Its not just 7 different versions of windows (remember you get different code generated if you run it on 64-bit v 32-bit, so your app has to handle registry paths being different for example), but also the vast amount of .NET version updates you have to download, and ensure your customers have installed.

    12. Re:The problem with VC++ by JaegerTCat · · Score: 1

      I'll see you VC++ 2008 and raise you VC++ .Net (aka VC++ 7.0, aka the 2002 release). String raise!
    13. Re:The problem with VC++ by Bluesman · · Score: 2, Funny

      Yeah, what's with all these weird functions like CMPXCHG, XOR, MOVS, and PUSH?

      That Windows C++ stuff, boy, it sure is weird!

      --
      If moderation could change anything, it would be illegal.
    14. Re:The problem with VC++ by Anonymous Coward · · Score: 0

      Yeah, shame on Microsoft for letting Netscape stagnate.

    15. Re:The problem with VC++ by turm · · Score: 1

      Orcas supports _InterlockedCompareExchange128 (CMPXCHG128). It should be in the Beta:
      http://msdn2.microsoft.com/en-us/vstudio/aa700831. aspx

    16. Re:The problem with VC++ by emarkp · · Score: 1

      Okay, but that post was from 8 months ago. Anything lately?

    17. Re:The problem with VC++ by dwye · · Score: 1

      > Still no C99, with open admission that there are no plans to support it.

      They are probably just waiting for C0x to be finalized, first (but unlike Stroustrup, are hoping that the x IS required to be in hex).

    18. Re:The problem with VC++ by jez9999 · · Score: 1

      Ironiocally, it's probably easier to migrate a C#.NET program away from Windows because of the existance of Mono.

    19. Re:The problem with VC++ by emarkp · · Score: 1
      Right, that's why they hired Herb Sutter as a software architect, right? You know, the Herb Sutter who is the chair of the ISO C++ standards committee.

      Frankly, the extensions to handle GC are some of the best (and yes, innovative) additions to C++ I've seen in a while, and make C++/CLI the most versatile .Net language IMO. I hope they make similar innovations in the area of threads (something Sutter has been talking about for years now).

    20. Re:The problem with VC++ by lordSaurontheGreat · · Score: 2, Informative

      Eclipse/CDT is so clunky as to be almost unusable for C++ development right now (don't flame me, it's just a personal opinion) but I check every now and then to see how things are going and it sounds like someone might be planning a big clean-up so it doesn't feel like C++ forced into a Java-friendly IDE any more.
      As a die hard Eclipse fan I have to violently agree with you. Eclipse is brilliant at Java development and gives poor little netbeans more than a run for its money in every respect except for the integrated profiler. But the Eclipse CDT is horrifically lame. I tried it. It had a bunch of things Eclipse-like that I enjoyed, but it was just so slow and unpolished that it didn't have the extra mile that we all associate with the Eclipse Quality.
      Bravo to you for recognizing crap in a otherwise golden framework. Many others wouldn't have your vision to recognize the garbage in the goldmine.
      --
      Consider yourself spoken to.
    21. Re:The problem with VC++ by ThousandStars · · Score: 1
      Certain features (I'm looking at you, browse toolbar) actually disappeared from VC++,

      Shouldn't that read, "Certain features: "I'm not looking at you because you're not there anymore, browse toolbar) actually disappeared from VC++?

    22. Re:The problem with VC++ by ultranova · · Score: 1

      If they had these managed languages for GUI development, and C++ for back-end efficiency then I'd be very happy as you'd get the best of both worlds.

      Crashing backends and slow GUIs ?

      Seriously, it's the backend which doesn't need to be lightning-fast, but absolutely must not choke on any data that's thrown to it. Make the backend with Java or something, and the GUI application with C, and you'll get the best of both worlds.

      --

      Forget magic. Any technology distinguishable from divine power is insufficiently advanced.

    23. Re:The problem with VC++ by gbjbaanb · · Score: 1

      not so, think about the web model which can have a slow, inefficient GUI processing XML, but needs a very efficient backend. Of course you can scale out and out and out like we see with poorly written, or resource intensive backends.

      The GUI can have a lot of ineffiency in it nowadays as the client will have a lot of ram and CPU dedicated to just it, but the server often isn't much more powerful than the client, and has to service a lot more than just a single user.

      Of course, we could just write everything in C, but we don't have that many programmers who are good enough :-)

  9. Just one thing by jeti · · Score: 1

    Please implement delegates and get rid of the method pointers.

    Thank you.

    1. Re:Just one thing by PhrostyMcByte · · Score: 2, Informative

      C++ has adopted Boost's function class in the TR1 library - you will be able to use std::function, etc. No more member function pointers if you don't want them.

    2. Re:Just one thing by Anonymous Coward · · Score: 0, Redundant

      Please replace the language with Haskell.

      Thank you.

    3. Re:Just one thing by mwvdlee · · Score: 1

      I'd like the Java "interface" mechanism in C++. It's pretty much the only thing that the Java syntax does better than C++ IMHO.
      That and a standardized, platform-independant networking library.

      --
      Slashdot social media options: AIM, ICQ, Yahoo, Jabber and Mobile Text. Why no MySpace?
    4. Re:Just one thing by Pr0xY · · Score: 2, Informative
      you can easily get the same effect as the java "interface" mechanism bu supplying a class which contains only pure virtuals (and a virtual destructor). For example:

      class AnimalInterface {
      public:
          virtual ~AnimalInterface() {}
      // note the = 0; on the next lines, that means "pure virtual"
      // pure virtual means "no implementation here, a child class must implement
          virtual void eat() = 0;
          virtual void poop() = 0;
      };
       
      class Monkey : public AnimalInterface {
      public:
          virtual void eat() { std::cout << "monkey eating!\n"; }
          virtual void poop() { std::cout << "monkey pooping!\n"; }
      };
      if a class inherits from AnimalInterface and fails to implement eat or poop, it will result in a compiler error, this the child class must implement the "interface" supplied by the parent class. And just like java, this is safe with regard to multiple inheritance because the pure virtual functions have no implementation, which means no ambiguity with regard to which parent function to call.
    5. Re:Just one thing by mwvdlee · · Score: 1

      The main benefit of Java interfaces is that you can have a single class implement multiple interfaces without having to resort to something like C++'s multiple inheritance. So the Monkey class can also implement HairyInterface, EvilInterface and SlingInterface.

      --
      Slashdot social media options: AIM, ICQ, Yahoo, Jabber and Mobile Text. Why no MySpace?
    6. Re:Just one thing by doti · · Score: 1

      Haskell is a wonderful language, but it's another completely different paradigm, it's not to replace C++.

      D is, it's C++ done right.

      C++ is a freak of programming languages. It has grown like cancer, much like HTML.
      If you wanted to add OO features to C, I think a simplistic approach like Perl's would be better.

      --
      factor 966971: 966971
    7. Re:Just one thing by smellotron · · Score: 2, Interesting

      The main benefit of Java interfaces is that you can have a single class implement multiple interfaces without having to resort to something like C++'s multiple inheritance. So the Monkey class can also implement HairyInterface, EvilInterface and SlingInterface.

      The main benefit of C++ abstract classes is that you can have a single class inherit from multiple abstract classes without having to resort to something like Java's interfaces.

      You think multiply inheriting from a bunch of C++ abstract classes is somehow worse than implementing multiple Java interfaces? Abstract classes are interfaces, and inheriting from an abstract class is identical to implementing an interface. All of the problems you hear about for the evils of multiple inheritance go away when you start talking about pure abstract classes. There's no worrying about "which parent class method will be active when they have identical signatures" since there aren no parent methods.

    8. Re:Just one thing by mwvdlee · · Score: 1

      I was just thinking that as the submit button did it's job :)
      Still though, it would be nice to have a mechanism that can't be easily abused, but I guess my main concern has been taken care of :)

      --
      Slashdot social media options: AIM, ICQ, Yahoo, Jabber and Mobile Text. Why no MySpace?
    9. Re:Just one thing by jeti · · Score: 2, Interesting

      Can Haskell interface with our existing C and C++ codebase?
      Does a compiler exist for ARM architectures?
      And do you think moving over to Haskell would work for my
      colleagues? Some of them do not have a formal education in
      CS and PL and are not too eager to learn something new.

    10. Re:Just one thing by jeti · · Score: 1

      I suspect that the function class uses method pointers internally.
      These are less efficient than delegates. And AFAIK the mechanism
      fails completely with some compilers if virtual base classes are
      used.

    11. Re:Just one thing by Anonymous Coward · · Score: 0

      Phil, just because you and the two grad students I share an office with think Haskell is the greatest thing since sliced bread doesn't make it true. Real men (well, the nearest modern approximation - I'm still pretty much in awe of Mel) write in assembly.

      I know, that's my anonymity pretty much out the window, and I expect to be receiving death threats from the other Haskell guy shortly.

    12. Re:Just one thing by jeti · · Score: 1

      Inheriting simple, abstract base classes is unproblematic enough
      in my experience. But the mechanism is less powerful than delegates.
      In Java, you can use an anonymous inner class implementing an interface
      instead of a delegate to handle callbacks. But in C++, a member class
      does not have anything like an outer class and it does not automatically
      have a friend status.

      With interfaces and anonymous inner classes, Java has an adequate
      replacement for delegates. On the other hand, method pointers already
      exist in C++. They're similar to delegates and are often used to
      implement the functionality of a delegate. But the mechanism is a lot
      more problematic and inefficient.

    13. Re:Just one thing by nuzak · · Score: 1

      > Abstract classes are interfaces, and inheriting from an abstract class is identical to implementing an interface.

      Except for slicing if you're dumb enough to actually cast to the object type itself. Of course, in the real world, you do everything with pointers (which is the only way to get polymorphism anyway), where you now have to GC them yourself, and deal with the fact that any object may be broken at any time (null or dangling). Real damn fun, that. Oh yeah, you can use boost::smart_ptr -- or is is boost::shared_ptr, or boost::kinda_shared_ptr_with_racing_stripes?

      C++ is an all right language with some nice features. Referencing and dereferencing is not one of them. Inscrutable page-long error messages from the compiler whenever you use even mildly complex templates is another.

      --
      Done with slashdot, done with nerds, getting a life.
    14. Re:Just one thing by WalterBright · · Score: 1

      Please implement delegates and get rid of the method pointers. Done. See the D programming language.
    15. Re:Just one thing by Skrapion · · Score: 1
      It should also be noted that being able to use a full-fledged class as an interface allows you to remove some redundant code. For instance, you can have an "interface" that looks like this:

      class Interface
      {
      public:
      virtual void AddString(const string& str) = 0;
      virtual void Flush() = 0;
      virtual void AddStringAndFlush(const string& str) { AddString(str); Flush(); }
      };
      It's a trite example, but I'm sure you can imagine how this sort of thing can save you a lot of code. Imagine implementing + and += operators for everything that implements the base class, even though the += operator always looks exactly the same. (And before you complain about how evil overloaded operators are, realize that Java still overloads the + and += operators for Strings -- they just don't believe you are trustworthy enough to overload operators for your classes.)
      --
      The details are trivial and useless; The reasons, as always, purely human ones.
    16. Re:Just one thing by Dan+Hayes · · Score: 1

      And of course, they don't bloody overload the == operator for Strings now do they, just to add to the fun that is Java.

    17. Re:Just one thing by smellotron · · Score: 1

      Imagine implementing + and += operators for everything that implements the base class, even though the += operator always looks exactly the same.

      Actually, stock operator overloading is a prime example for the Curiously Recurring Template Pattern. Boost probably has a library somewhere that does this already, but you can do something like

      template <class Derived>
      class Addable
      {
      viritual ~Addable() {} // C++ boilerplate

      // requires operator+= to be defined
      Derived operator+(const Derived &other) {
      Derived sum(*this);
      this += other;
      return other;
      };

      class Number : public Addable<Number> {
      // viola! if we define +=, + comes "for free"
      };
    18. Re:Just one thing by smellotron · · Score: 1

      Except for slicing if you're dumb enough to actually cast to the object type itself. Of course, in the real world, you do everything with pointers (which is the only way to get polymorphism anyway)...

      Yeah, slicing sucks... but slicing, dangling pointers, and reference counting are all entirely orthogonal to the concept of abstract-classes-as-interfaces. Java could have implemented interface Foo { void doFoo(); } as abstract class Foo { void doFoo(); } or class Foo { void doFoo() = 0; } without changing how they work.

    19. Re:Just one thing by Skrapion · · Score: 1

      Yep, and it works pretty well, but you still need to be able to use a non-pure-virtual base class as an interface if you want to avoid duplicated code.

      --
      The details are trivial and useless; The reasons, as always, purely human ones.
    20. Re:Just one thing by Pr0xY · · Score: 1

      indeed it does and it works very well:

      http://www.boost.org/libs/utility/operators.htm

      proxy

    21. Re:Just one thing by MobyDisk · · Score: 1

      It's exactly the same in C++ as it is for Java. If you want multiple interfaces, just separate them by commas just like in Java. No magic required.

  10. scratch that itch by CarpetShark · · Score: 1

    It would be fine if there was a functional version of this:

    texttospeech --output-format simplehtml vid.txt

    1. Re:scratch that itch by mwvdlee · · Score: 2, Funny

      I'd much rather prefer speechtotext in this particular case, but to each his own.

      --
      Slashdot social media options: AIM, ICQ, Yahoo, Jabber and Mobile Text. Why no MySpace?
    2. Re:scratch that itch by CarpetShark · · Score: 1

      Yes, typo :D

  11. Re:C Plus Plus Bye Bye by Omni-Cognate · · Score: 4, Informative

    Not that job listings are a particularly good indicator of anything, but from Monster:

    The C++ ones include plenty of new systems.

    --

    "The Milliard Gargantubrain? A mere abacus - mention it not."

  12. Parent is trolling by Interfacer · · Score: 3, Informative

    C99 is driven by customer demand. And I don't mean as in a bunch of geeks saying 'implement ALL of C99 now!' but as in they work with their enterprise customers to prioritize features.

    TR1 WILL be supported as soon as C++0x is finalized. Not sooner. If they would implement is now, it would likely change as soon as the new standard is ratified. Of course, even if they would implement now, you would criticise them as soon as the standard is ratified because ZOMG! Microsoft's TR1 is proprietary and out of date! LOLOLOLROFLMAO!
    I suspect they will simply license TR1 from dinkumware which is feature complete with the current state of TR1.

    Intellisense is a dog. People are working on it, and a lot of redesign is going on. Not just for intellisense, but for the whole compiler architecture to make it more scalable and plufable.

    And I don't know where you are getting your info from, but asm is perfectly supported in 64 bit. Just inline assembly isn't because for 64 bit code this would make it non-portable between different 64 bit architectures.
    You can still add asm files to your VC++ project and compile them.

    And you can say yuck to MFC and I would agree. But a very large number of enterprise businesses still builds massive VC++ applications that use it extensively. maintaining and improving it makes lots of business sense.

    And finally, C++ is not meant to be as RAD as C# and VB because that would require a lot of manpower which cannot be justified. VC++ is targeted for interoperability, performance and control over the program execution. Not for whipping up a data driven LINQ doc. People who want to use LINQ would simply build a C# project for data interaction and add it to their mixed mode C++ project.

    1. Re:Parent is trolling by PhrostyMcByte · · Score: 3, Interesting

      These are complaints, not trolls. I develop primarily in C++ and am ecstatic about C++0x, and dread seeing my favorite IDE/compiler get put on the backburner and not implement modern unmanaged programming. I don't want to wait 10 years to see C++0x and TR1. They could have easily included Dinkumware's TR1 implementation with it, even in a seperate tr1 namespace, and be sure - everyone would be much much happier.

      C++ was not meant to be RAD like C#, but VC++'s compiler and IDE are _far_ from perfect. There are still several annoying little issues you come across when you play with real C++. My point was that there is so much room for improvement in the C++ compiler but they have completely neglected it and the IDE to implement features for their proprietary languages. Which all in all, this being Microsoft, is not that surprising - but it is still a shame.

      You got one thing right - I did mean inline assembly (sorry, typos happen). It would be just as non-portable as using seperate .asm files - the functionality was there in the x86 compiler, am I to assume they completely rewrote the compiler enough that it would take vast effort to enable this basic functionality for x64?

    2. Re:Parent is trolling by snemarch · · Score: 1

      Smart developers don't use inline assembly, but use external asm modules. Easier to port source between compilers that way, you can use a full-featured assembler with macro support etc.

      If you complain that it's too big a fuzz compared to inline assembly, well, chances are good that your piece of code is so small/insignificant you shouldn't be dealing with assembly at all - or at least you should refactor the code and do a larger chunk in (external) assembly.

      --
      Coffee-driven development.
    3. Re:Parent is trolling by PhrostyMcByte · · Score: 2, Insightful

      A lot of C++ developers are fans of header-only libraries. What can I say, I am too - it makes use of these libraries so much easier. Having assembly files breaks this when writing a library.

      I agree that a good developer will almost never need to use assembly. Unfortunately there are some (very few, but still some) things you just can't do efficiently in C++ - be it a limitation of the language or the compiler.

      Believe me, I wish Microsoft could implement intrinsic functions for everything I need (like CMPXCHG16B mentioned previously). But they don't. I want nothing more than to not have to touch assembly!

    4. Re:Parent is trolling by MORB · · Score: 2, Interesting

      Bullshit. They could (should) start implementing TR1 and even parts of C++0x right now so that they can have a fully compliant implementation shortly after the standard is officially released. That's what gcc is doing. It also helps the stadndardization process because they can see whether the current draft has serious issues and fix them.
      gcc has a TR1 implementation and they have started implementing some of the c++0x features (that should be enabled explicitely on the command line)

      In any case, VC++ majorly sucks. It's slow (and gets significantly slower at each new version), takes ages to do elementary things (I've seen it take 10 to 20 seconds to open a fucking text file - and a small one at that), has a sucky interface (as of vs2005, the project properties dialog was still not resizeable and full of small text fields meant to contain lots of data, like list of libraries. And don't even get me started on the project configurations dialog), don't really have any features not found anywhere else and they don't even work that well (how easily the code completion system fails). To do anything really useful like some automated refactoring operations, you have to install a third party tool (visual assist)

      The project management, with its file/directory hierarchy which is not taken directly from the file system, is completely stupid and annoying (I worked at a MMORPG company on a solution containing dozens of project, and the hierarchy layout in visual studio and the file system were completely different, a fucking nightmare)

      It also don't play well with version control tools, because it like to save the contents of the xml in project files in a different order each time, so even a trivial change will show lots of diffs in version control, making it impossible to figure out which compilation setting was changed frmo a version to another, for instance.

      I don't know, I just can't find any redeeming feature in this IDE. As far as I'm concerned, when it comes to C++ it's a worthless piece of shit that is only used out of market inertia. It used to be alright, but the performance went down while the features stayed roughly the same except for those awesome 3d toolbars, so now it just doesn't seem to be worth its (rather high) price point compared to free alternatives like eclipse/cdt (or even kdevelop 3.4 if it was available for windows).

      And don't come to me saying that a free version is available, its irrelevant to the professional world which have to pay for the dubious privilege of using this thing.

    5. Re:Parent is trolling by Anonymous Coward · · Score: 0

      As a budding C++ programmer on a Win32 platform, what should be using then? Borland's C++ Builder, Eclipse and some sort of c++ compiler? VS2005 seems to be the dominate player and I'm sure any other compilter/IDE has just as many bugs and annoyances.

    6. Re:Parent is trolling by MORB · · Score: 2, Informative

      You can use eclipse/mingw, code::blocks, etc.
      Alternatives are out there if you take the effort of using google.

      Your apathetic comment demonstrates what I meant by "market inertia".

    7. Re:Parent is trolling by prencher · · Score: 1

      Or.. You could just use boost which includes (most of) TR1 in 1.34.

    8. Re:Parent is trolling by Anonymous Coward · · Score: 0

      those awesome 3d toolbars are the problem! I only have 1Gb on my work laptop (only, ha!) if I open 2 VS2005 sessions it uses more memory than Firefox with the default cache settings viewing Flickr.com!

      I dread to try it on Vista, combine the .NET-built VS2005 and the .NET-built Aero interface and I think I'll have to invest in a 32Gb machine or get used to hearing the swapfile grow.

    9. Re:Parent is trolling by geckofiend · · Score: 1

      Oh please. Eclipse/mingw is such a non-optimal solution for doing Win32 development that virtually any issue with Dev Studio would be tolerable.

    10. Re:Parent is trolling by snemarch · · Score: 1

      I've never been much of a fan of intrinsics, they tend to lock you both to specific hardware and a specific compiler vendor - unless you accept #ifdef hell in your source files.

      I prefer to have as much of the platform-specifics as possible in the build system, where it's pretty easy to use either a foo-x86.asm or foo-x64.asm file.

      For some of the lockless algorithms where you'd want to use CMPXCHG16B I know it's not too pretty to rewrite the entire thing in assembly, and doing a function call just for that instruction kind of defeats the purpose - and for other stuff, like writing an OS kernel, you might not care how portable your source is (for anybody talking about how portable linux is, do realize the difference between toolchain-portable and hardware-portable).

      Btw, there isn't a 64bit version of "InterlockedCompareExchange"? With some IFDEFs (sigh :)), that set of API call turns into instruction-emitters.

      Btw there's a lot of free (including source) assemblers that'll work for multiple systems and support both x86 and x64... FASM, NASM, YASM to name a few.

      --
      Coffee-driven development.
    11. Re:Parent is trolling by Anonymous Coward · · Score: 0

      Try mingw and console vim. No hand holding, no GUI, no IDE. You'll either master C++ or go bald from frustration by the time you turn 20.

    12. Re:Parent is trolling by m2943 · · Score: 1

      but for the whole compiler architecture to make it more scalable and plufable.

      I, for one, think VisualStudio is plufable enough already!

    13. Re:Parent is trolling by durdur · · Score: 1

      Right. IMHO VC++ is quite usable. Granted, I don't like editing code in it, but it is a reasonably nice visual debugging environment. And the compiler is a nice piece of work: stable, fast, puts out good code.

    14. Re:Parent is trolling by Anonymous Coward · · Score: 0

      C99 is driven by customer demand. And I don't mean as in a bunch of geeks saying 'implement ALL of C99 now!' but as in they work with their enterprise customers to prioritize features. That may be a partially true but I don't think MS would really support C99 even if their enterprise customers demanded it. C99 is a small language and easy to support (although it has its legacy). The level of competition would be way too close to them.
    15. Re:Parent is trolling by Anonymous Coward · · Score: 1, Interesting

      Please try WinDbg--it's only a little harder to use, far more powerful, and updated more often. It's also a free binary from Microsoft, who use it extensively inhouse.

      Ditto on VC++ being a crummy editor. In fact almost all the blue badges (full-time Microsoft employees) I met were dedicated vim users, except for a few Emacs freaks like me.

  13. With all respect... by 2Bits · · Score: 2, Insightful

    to Stroustrup, but don't you think it's a bit ironic that the creator of such a monstrosity is talking about ideal of programming languages? And don't even get me into the the differences between implementations!

    Yeah, go ahead, bring out your flame hose. Even if I had to burn in hell, this thing is still a monstrosity.

    1. Re:With all respect... by ardor · · Score: 2, Informative

      C++ is far too complex yes. But there is nothing that can really replace it. A language which supports functional, generic, procedural, object-oriented programming, with static typing, metaprogramming, and heavily geared towards native building? I mean, do you know a language which can resolve iterators to simple pointer arithmetic when compiling? Of course there are far better languages feature-wise, but they all demand some performance penalties. This may or may not be relevant. For example, for video codecs its relevant, as it is for most other realtime stuff (try capturing with Java and its GC for instance).

      So, C++ fills a niche. D *may* be a replacement, but I am skeptical. I don't know Eiffel well enough though, this may be a good candidate.

      And lets not forget that C++ toolchains are among the most optimized and tested ones. For example, Lisp could be able to reach C++ performance, but doesnt simply because the Lisp toolchains arent as optimized. A simplified example: sometimes SBCL does register->memory->operation->register calls, where g++ optimizes to register->operation. And, the amount of C++ code in existence is staggering.

      --
      This sig does not contain any SCO code.
    2. Re:With all respect... by MichaelSmith · · Score: 1

      Of course there are far better languages feature-wise, but they all demand some performance penalties

      Pure OO C++ code I have seen, generated direct from UML, performs hopelessly against a C equivalent because of its reliance on memory allocation.

    3. Re:With all respect... by Anonymous Coward · · Score: 0

      If C++ didn't exist, today in 2007, it would need to be invented. Bjarne and company saved us 20 years of development. The syntax and feature set actually make sense, if you're willing to invest the time to learn to use them properly.

      What language would you use to write a commercial quality DBMS or web browser, for instance? I suppose you could use Objective C, but that is much more obscure (in terms of compiler availability and the community of trained developers) than C++.

    4. Re:With all respect... by Dr.+Manhattan · · Score: 2, Interesting
      C++ isn't just "too complex". It's "so overly complex that it becomes a real problem." From The Art Of Unix Programming: "Compactness is the property that a design can fit inside a human being's head. A good practical test for compactness is this: Does an experienced user normally need a manual? If not, then the design (or at least the subset of it that covers normal use) is compact... C++ is anti-compact -- the language's designer has admitted that he doesn't expect any one programmer to ever understand it all."

      With all the libraries and the plethora of features, it also has a large measure of Perl's problem: "Some designs that are not compact have enough internal redundancy of features that individual programmers end up carving out compact dialects sufficient for that 80% of common tasks by choosing a working subset of the language. Perl has this kind of pseudo-compactness, for example. Such designs have a built-in trap; when two programmers try to communicate about a project, they may find that differences in their working subsets are a significant barrier to understanding and modifying the code."

      The summary, here: "When all is said and done, however, C++'s most fundamental problem is that it is basically just another conventional language. It confines the memory-management problem better than it did before the invention of the Standard Template Library, and a lot better than C does, but the confinement is brittle; it breaks unless your code uses objects and only objects. For many types of application its OO features are not significant, and simply add complexity to C without yielding much advantage. Open-source C++ compilers are available; if C++ were unequivocally superior to C it would now dominate... Consider using C++ if an existing C++ toolkit or service library offers powerful leverage for your application, or if you're in one of the application areas mentioned above for which an OO language is known to be a large win."

      --
      PHEM - party like it's 1997-2003!
    5. Re:With all respect... by rbanffy · · Score: 1

      "A language which supports functional, generic, procedural, object-oriented programming, with static typing, metaprogramming, and heavily geared towards native building?"

      The real question is "do we need a single language that has all these different goals built in?"

      We probably have better solutions in each and every problem C++ proposes to solve.

    6. Re:With all respect... by hr.wien · · Score: 2, Interesting

      Why does everyone coding OO in C++ seem to think you need to new and delete every damn object? Use the stack and the RAII pattern whenever possible (which, in my experience, is most of the time). It'll make your code both cleaner and safe from resource leaks.

    7. Re:With all respect... by Goaway · · Score: 1

      I'm a huge fan of Objective-C, but I'll still admit that it loses to C++ in terms of performance. Message passing and the lack of objects on the stack mean it will never be quite as fast.

      Still, it's a shame it's not more prevalent, because it's a wonderful language for a lot of real-world tasks.

    8. Re:With all respect... by EsbenMoseHansen · · Score: 1

      Does an experienced user normally need a manual? If not, then the design (or at least the subset of it that covers normal use) is compact... C++ is anti-compact -- the language's designer has admitted that he doesn't expect any one programmer to ever understand it all."

      OK. I'm an experienced user, and I don't refer to a manual, except when doing something really exoteric, like placement new (I know it exists, I have yet to find a use for it). So normally, I don't. Heck, I don't even own a manual.

      --
      Religion is regarded by the common people as true, by the wise as false, and by rulers as useful.
    9. Re:With all respect... by baadger · · Score: 2, Informative

      Let's not forget that you can actually overload the "new" and "delete" operators and drop in your own memory allocator if you wish...

    10. Re:With all respect... by gbjbaanb · · Score: 1

      "Compactness is the property that a design can fit inside a human being's head. A good practical test for compactness is this: Does an experienced user normally need a manual? Depends what you mean by the language? Do you need a manual for the CRT? or the STL? Are these part of the language? Is Java compact, or does it have such a massive library that you need a giant tome to keep track of the features?

      I'd say that C++ is remarkably compact, you can know everything there is about it easily. What you'll then find is that it is flexible and so well designed that you can twist it about in remarkable ways, but if you do, that says more about you as a programmer and not the language itself.
    11. Re:With all respect... by Dr.+Manhattan · · Score: 1

      I'm an experienced user, and I don't refer to a manual...

      Second paragraph of my comment.

      --
      PHEM - party like it's 1997-2003!
    12. Re:With all respect... by Duhavid · · Score: 1

      Every language that has been conjured to try to match this "compactness"
      idea ends up reducing it's usefulness in solving problems.

      --
      emt 377 emt 4
    13. Re:With all respect... by m2943 · · Score: 1

      A language which supports functional, generic, procedural, object-oriented programming, with static typing, metaprogramming, and heavily geared towards native building?

      C++ does not "support" functional programming, generic programming, object oriented programming, or even metaprogramming; if you invest a lot of work and effort, you can approximate small subsets of these programming styles in C++, badly. And I have yet to see that it's worth the effort; the best and most common use of C++ still seems to be as a slightly better C.

      C++ is far too complex yes. But there is nothing that can really replace it.

      Well, that is true in a very limited sense: there are specialty high performance applications in which there is no substitute for C++. However, most software should simply not be written in C/C++ anymore, software like Firefox, OpenOffice, KDE, etc.

    14. Re:With all respect... by k-zed · · Score: 2, Insightful

      "A language which supports functional, generic, procedural, object-oriented programming, with static typing, metaprogramming, and heavily geared towards native building?"

      Yes. It's called LISP. (Also Scheme, and maybe even OCAML.)
      There are optimizing LISP compilers that beat C/C++ at floating point calculations. Plus C, and all the new trendy MS .NET crap has nothing on the syntax and expressive power LISP has. But good things and good directions aren't exactly "in fashion" in today's IT...

      --
      we discovered a new way to think.
    15. Re:With all respect... by 2short · · Score: 1

      "But good things and good directions aren't exactly 'in fashion' in today's IT..."

      Or yesterdays, or the day before that... It's amazing just how long "fashion" has kept the ultimate programming language from gaining any traction.

    16. Re:With all respect... by MenTaLguY · · Score: 1

      I'd say that C++ is remarkably compact, you can know everything there is about it easily.

      I've been writing C++ code for the past 15 years, and I beg to differ. I still occasionally run across obscure features of the language that I'd missed before.

      In fact, over my 20-year programming career, it's the least compact language that I've ever become proficient in (which includes Java, JavaScript, Prolog, Scheme, C, dBaseIII+, Perl, Ruby, posix sh, Scala, TCL, Robotic, VB, assorted "classic" BASIC flavors, Haskell, and probably some others I've forgotten).

      Libraries can offset the simplicity of a language somewhat (e.g. Java), but even when you consider C++'s libraries, it's much harder to find or use C++ libraries in a uniform way than in most other languages. Don't even get me started on the ABI issues.

      --

      DNA just wants to be free...
    17. Re:With all respect... by EsbenMoseHansen · · Score: 1

      "Compactness is the property that a design can fit inside a human being's head. A good practical test for compactness is this: Does an experienced user normally need a manual? Depends what you mean by the language? Well, usually I mean just the language, with perhaps the essential standard libraries. What the grandparent meant I don't know.

      Do you need a manual for the CRT? or the STL? Are these part of the language? No, I normally don't need the manual for those. I might need it if I do something esoteric, such as string made of of something beside characters. But the key word is normally,

      Is Java compact, or does it have such a massive library that you need a giant tome to keep track of the features?

      In my opionion, the java library is too expensive. Not because of the compactness problem, which is less of a problem in libraries than in the language, but because anything in the library is there to stay for a long time. Like strncpy in the C library... it really never should've been put there, but we are still saddled with it. Or thread.stop() in the java libs.

      I'd say that C++ is remarkably compact, you can know everything there is about it easily. What you'll then find is that it is flexible and so well designed that you can twist it about in remarkable ways, but if you do, that says more about you as a programmer and not the language itself. Yes, that's the flexibility that makes thing like boost::spirit possible.
      --
      Religion is regarded by the common people as true, by the wise as false, and by rulers as useful.
    18. Re:With all respect... by ardor · · Score: 1

      As said, LISP compilers I know dont beat gcc 4.

      --
      This sig does not contain any SCO code.
    19. Re:With all respect... by ardor · · Score: 1

      C++ does not "support" functional programming, generic programming, object oriented programming, or even metaprogramming; if you invest a lot of work and effort, you can approximate small subsets of these programming styles in C++, badly. And I have yet to see that it's worth the effort; the best and most common use of C++ still seems to be as a slightly better C.

      I use generic programmming and metaprogramming very often in C++. I does pay off. See http://www.antigrain.com/ for an example.

      I agree that without templates C++ has no real advantages though.

      --
      This sig does not contain any SCO code.
    20. Re:With all respect... by Anonymous Coward · · Score: 0

      "A language which supports functional, generic, procedural, object-oriented programming, with static typing, metaprogramming, and heavily geared towards native building?"

      You answered yourself: Lisp. The "register->memory->operation->register" thing doesn't really mean much when you don't give an example of what would cause that. Off the top of my head I'd question your use (or lack) of declaim and type indications. And regardless, judging it by one implementation of one Lisp dialect is pretty weird, especially one based on the cruft of shit that is CMUCL and doesn't particularly focus on efficiency anyway. Maybe you should try ECL's C output sometime?

      Or a completely different dialect: Scheme. Particularly the Chicken implementation's C output. I'll grant that Scheme isn't the the most popular Lisp, but R6RS's library system is going to go a long way towards smoothing implementation differences much the way CL's packages do. If people start writing shit like a "SFFI" or moving TinyCLOS to its library system, it's going to start getting a lot more attention.

      None the less, I will also grant that C/C++ compilers have had a lot more manhours put behind them. But don't knock Lisp's effecicency based on one one implementation's possible flaws.

    21. Re:With all respect... by Anonymous Coward · · Score: 0

      Don't even get me started on the ABI issues.

      Wait, let me get started then: ABI incompatibility has been (still is) a major source of trouble everywhere I have been working. I was told this has been finally standardized but from what I can see it still did not happen on old (3+ years) systems. As a result: I routinely face C++ standard lib incompatibilities everywhere I look, which forces us to have development environments on all our production platforms. More than just a technical issue, it becomes political. C++ has been (still is) the source of all my nightmares since about 15 years, I wish Stroustrup had become a painter instead.

      Over the last few years we have slowly turned to C libraries and main() programs written in Python. Never had any trouble with standard lib compatibility, performance is vastly superior to raw C++ (every CPU-intensive operation is written in C), the number of bugs is drastically reduced, and development time is at least halved. Some of our C++ applications have so many bugs I do not even know how they can still be called software.

    22. Re:With all respect... by MemoryDragon · · Score: 1

      With all due respect, but if C++ would not have been invented we all would be using objective C and be way happier, the language is the classical example of ignoring any sanity in language design. As for commercial developers, without C++ all C++ gurus now would be ObjectiveC gurus. ;-)

    23. Re:With all respect... by 19thNervousBreakdown · · Score: 1

      Huh? Yech, I'm glad I don't work where you work. I'd say new and delete show up 0-5 times in an average project, generally buried way down in some RAII class. Either that or some jerk wrapped them around an API call that "won't ever fail." Fmeh. getpid() will fail if there's memory allocation within 8 lines.

      --
      <xml><I><am><so><damn>Web 2.0</damn></so></am></I></xml>
    24. Re:With all respect... by LeninZhiv · · Score: 1

      "exoteric": not a word (unless you just coined it with a subconscious combination of "esoteric" and "exotic", but we'll have to wait to see if it catches on).

    25. Re:With all respect... by m2943 · · Score: 1

      I use generic programmming and metaprogramming very often in C++. I does pay off. See http://www.antigrain.com/ for an example.

      Many people use templates for generic programming and metaprogramming; that doesn't prove that they are actually useful or that it "pays off" compared to simpler constructs, since pretty much nobody ever bothers making the comparison. Given that most of those libraries, even high performance commercial libraries, have been written without such constructs, it's reasonable to postulate that it doesn't.

      Furthermore, being able to do it in C++ doesn't mean C++ "supports" it. Generic programming and metaprogramming in C++ is very limited in what you can do relative to languages that were designed with support for those features, it taxes compilers to the limit, it uses constructs intended for completely different purposes, and it gives lousy compiler diagnostics to users.

    26. Re:With all respect... by ardor · · Score: 1

      Given that most of those libraries, even high performance commercial libraries, have been written without such constructs, it's reasonable to postulate that it doesn't.

      Wrong conclusion. That would mean type safety doesnt pay off because even high performance commercial libraries have been written without such constructs. Yes, you can do it without templates in C++, but it won't be as flexible, or fast.

      Generic programming and metaprogramming just came to happen in C++, that is correct, and pretty much the point why I look for an alternative. I want a language where I get *compile-time* templates, e.g. the generalization is resolved while compiling, and not at run-time. So far, only D provides that. D *is* a language designed with these two in mind. Maybe it is the best candidate for replacement....

      --
      This sig does not contain any SCO code.
    27. Re:With all respect... by EsbenMoseHansen · · Score: 1

      "exoteric": not a word (unless you just coined it with a subconscious combination of "esoteric" and "exotic", but we'll have to wait to see if it catches on).

      Ok, sorry. English is my second language, but I will bear it in mind :)

      --
      Religion is regarded by the common people as true, by the wise as false, and by rulers as useful.
    28. Re:With all respect... by Anonymous Coward · · Score: 0

      With all respect...

      C++ has almost been developed exactly as planned. It is not meant to meet some academic ideal of prettiness. It is pretty in a pragmatic and practical sense. It is meant to be backward compatible with C, fast and useful. If you understood the history of C++ you would understand why it is the way it is. This is not by mistake or error but by design.

      Bjarne has a very good idea of a what a good programming language is. This is represented by how good C++ is given the constraints it has been developed under.

      I think if you took more time to understand before flaming you would see why C++ is a unique beautiful flower and not a monstrosity.

    29. Re:With all respect... by m2943 · · Score: 1

      Wrong conclusion. That would mean type safety doesnt pay off because even high performance commercial libraries have been written without such constructs. Yes, you can do it without templates in C++, but it won't be as flexible, or fast.

      No, it doesn't mean that; type safety is widely used and preferred, while only a small minority of C++ programmers actually do active metaprogramming (meaning, anything more than use existing libraries).

      In any case, the basic point is still that nobody has ever shown that metaprogramming or generic programming in C++ improves programmer productivity or software quality.

      So far, only D provides that. D *is* a language designed with these two in mind. Maybe it is the best candidate for replacement....

      Well, it may be the best candidate for a replacement, but I think D metaprogramming is still quite poor and limited; merely cleaning up the C++ syntax just isn't enough.

    30. Re:With all respect... by ardor · · Score: 1

      In any case, the basic point is still that nobody has ever shown that metaprogramming or generic programming in C++ improves programmer productivity or software quality.

      Boost shows it every day. The STL shows it every day. Perfect example: std::vector becomes a bitset, and std::fill in turn fills this bitset using an optimized memset instead of setting each bit individually. These decisions are made at compile-time, where they belong. As said, look into Alexandrescu's Modern C++ Design book, and have at least a look at policy-based design. You'll never want to go back to dull templateless MFC-era C++ again. Constructing delegates is also impossible without templates (and a good example where the language gets a new feature by additional code, not adding a new language keyword).

      Well, it may be the best candidate for a replacement, but I think D metaprogramming is still quite poor and limited; merely cleaning up the C++ syntax just isn't enough.

      I'm curious. Give me examples of less limited metaprogramming.

      --
      This sig does not contain any SCO code.
    31. Re:With all respect... by Rick+BigNail · · Score: 1

      It isn't TOO bad.

      At the very least, I don't think C++ as described in the following document is too complex.

      http://www.research.att.com/~bs/hopl2.pdf

    32. Re:With all respect... by m2943 · · Score: 1

      Boost shows it every day. The STL shows it every day.

      I'm not disputing that Boost and the STL are general. Vastly general, in fact. But there are costs: development, risk of errors, compilation times, more difficult debugging, code bloat, porting, training, compiler bugs, etc. Nobody has demonstrated that Boost/STL-style development has overall more benefits than it has costs.

      Believe me, I have been down this road, written quite a few generic C++ libraries even before it was popular, and in the end concluded that it didn't survive a cost/benefit analysis.

      Perfect example: std::vector<bool> becomes a bitset, and std::fill in turn fills this bitset using an optimized memset instead of setting each bit individually

      I'm sorry, what is this supposed to be a "perfect example" of?

      vector<bool> is a hand-written, specialized version of vector<T>, so, in fact, it's an example of where genericity fails and you have to resort to overloading and manual specialization. Furthermore, using the vector<bool> notation instead of a distinct name like bit_vector means that (1) the code needs to pull in vector<T>, (2) the expected unpacked vector<bool> version is unavailable even though it is what is usually needed, and (3) users don't even know what space/time tradeoff they are getting when they are using vector<bool> (and may not even be aware that this is a special case).

      Furthermore, what makes you think you're getting efficient, specialized versions of the generic algorithms? Even if you're lucky and you get it for fill, what about all the other generic algorithms?

      I'm curious. Give me examples of less limited metaprogramming.

      CommonLisp, Smalltalk, Python, Haskell, ML, ...

    33. Re:With all respect... by ardor · · Score: 1

      Believe me, I have been down this road, written quite a few generic C++ libraries even before it was popular, and in the end concluded that it didn't survive a cost/benefit analysis.

      So you prefer writing a list container for each type. Or a void* cast.

      vector is a hand-written, specialized version of vector, so, in fact, it's an example of where genericity fails and you have to resort to overloading and manual specialization.

      No, its not. From the outside, you don't have to change a single line of code for this. The outside world does not need to be aware of these internals, or any types.

      Furthermore, using the vector notation instead of a distinct name like bit_vector means that (1) the code needs to pull in vector, (2) the expected unpacked vector version is unavailable even though it is what is usually needed, and (3) users don't even know what space/time tradeoff they are getting when they are using vector (and may not even be aware that this is a special case).

      bit_vector is in fact available: as a typedef from vector. An unpacked version makes absolutely no sense, since it is semantically identical. Its when you want to access that as a memory block where the differences appear, but this is no longer generic. As for (3), thats what documentation is there for.

      Furthermore, what makes you think you're getting efficient, specialized versions of the generic algorithms? Even if you're lucky and you get it for fill, what about all the other generic algorithms?

      The point is the *possibility* of efficient, specialized versions. As said, std::fill with a vector can be reduced to a simple memset. At compile-time. No branches, no overhead, no indirections.

      CommonLisp, Smalltalk, Python, Haskell, ML, ...

      See they are NOT in the same league. These languages offer wonderful constructs which allow generic programming even at run-time - but at a cost. I like templates because they are generic at *compile-time*, which yields a significant performance boost. I am able to switch transformation and convolution kernels in a code just by defining a different policy at compile-time, for example. Run-time generic behaviour would not only be useless, but actually harmful to performance. I am talking about real-time stuff here.

      But this is another sign that C++ is actually best for system and performance-critical programming. For applications, I'd prefer Common Lisp or Objective C over C++ any day. Thus, components in C++, application in Python/CL/ObjC/Haskell sounds like a good bet. Oh, C++ is predominant in game development, too, and I don't see any sign of weakening. But then again, game dev. counts as soft realtime, with the notable exception of game logic, which actually *can* be done in another language (but that usually does not pay off because of the complexity of the glue layer). Scripting languages are on the rise (Lua comes to mind), so thats yet another trace evidence that C++ is for the components.

      --
      This sig does not contain any SCO code.
    34. Re:With all respect... by m2943 · · Score: 1

      So you prefer writing a list container for each type. Or a void* cast.

      No; I have no problem with parameterized types. We're discussing metaprogramming and generic programming.

      The point is the *possibility* of efficient, specialized versions. As said, std::fill with a vector can be reduced to a simple memset. At compile-time. No branches, no overhead, no indirections.

      Yes, manually creating specialized versions is a good thing for efficiency. My point is that it is the exact opposite of metaprogramming or generic programming. The very fact that library authors manually specialize std::fill tells you that the generic version is inefficient and that metaprogramming has failed for that type.

      (Quite separately from that, I'm making the point that overloading vector<bool> with bit_vector has a number of other problems.)

      See they are NOT in the same league. These languages offer wonderful constructs which allow generic programming even at run-time - but at a cost. I like templates because they are generic at *compile-time*, which yields a significant performance boost.

      First, several of the languages I mentioned do offer compile-time metaprogramming (ML, Haskell, etc.). Second, the distinction between compile-time and runtime disappears when JITs enter the picture; JITs permit generic programming and metaprogramming using existing object-oriented techniques, without the complexity of adding a separate static programming language. JITs basically make static metaprogramming facilities obsolete (Java/JVM got a few details wrong, but the next generation or two will fix that).

      As for performance, I write performance critical code in C++; it sounds to me like you really do not. Why? Because of statements like "An unpacked version makes absolutely no sense, since it is semantically identical." and "The point is the *possibility* of efficient, specialized versions." In fact, when performance matters, the difference between a packed and an unpacked boolean array can be big, and the difference between a possible and an actual specialized version is crucial.

    35. Re:With all respect... by ardor · · Score: 1

      JITs basically make static metaprogramming facilities obsolete (Java/JVM got a few details wrong, but the next generation or two will fix that).

      I keep hearing this over and over, I'll believe it when it actually arrived.

      As for performance, I write performance critical code in C++; it sounds to me like you really do not. Why? Because of statements like "An unpacked version makes absolutely no sense, since it is semantically identical." and "The point is the *possibility* of efficient, specialized versions." In fact, when performance matters, the difference between a packed and an unpacked boolean array can be big, and the difference between a possible and an actual specialized version is crucial.

      Maybe I misspelled it, I meant that *access* to the container is the same; in both cases, I add a binary value, iterate over the container etc. Of course the difference lies in the performance, this is the very *point* of template specialization for std::fill. I just don't see any point in an actual std::vector container. If you access it with the public methods, it behaves just like a bitset (excluding performance). If the vector has a bool typename, then you can also use bitset-specific methods.

      It is blindingly obvious that a bitset has advantages over a regular bool array. So, it should be also obvious that a specialized version of a std::fill is an improvement. (Simplifying this; there are issues with bitsets, as you said.) You say this is a sign of failure, but I do not. It is an *improvement* in a special case. The generic case works as best as possible, and the specialized one exploits ... well, a special situation. If I write a generic x86 software rasterizer, and one for SSE4, then the generic one didn't "fail". The SSE4 one is just an improvement, it exploits resources otherwise unreachable.

      Another example: math vectors.

      Basic: template class Vec;

      There are functions for adding, subtracting, normalizing, calculating dot products etc. of a Vec class.

      And for Vec there is also a function cross(), which calculates the cross product of 3D vectors.
      Did Vec fail? No, of course not. It is an improvement; I *add* functionality for special cases (here, a cross product). For 4-D vectors, I could add functionality to treat the vector as a quaternion for example. You call this a failure?

      --
      This sig does not contain any SCO code.
    36. Re:With all respect... by Anonymous Coward · · Score: 0

      If you don't understand why manual template specialization fails to be an example of generic programming, or why packed bit vectors are rarely a good substitute for boolean vectors, any further discussion is pointless.

    37. Re:With all respect... by ardor · · Score: 1

      No, I don't. Ok, the compiler *could* deduce the memset optimization by himself, but what about the other example I gave, the one with the cross product? How can *this* be a failure? A cross product is defined for 3d and 7d vectors _only_ (the wedge product is not the same).

      And I _said_ that bit vectors have their issues. My point was that simple use from outside does not differ from bool vectors. for (iterator it = vec.begin(); it != vec.end(); ++it) { bool b = (*it); } for example; this code will read bools from the vector, and it does not matter how they are stored. I didn't have a case where the difference really matters yet in such simple operations (except for manual reads of the vector array). Do you know one?

      --
      This sig does not contain any SCO code.
  14. Re:C Plus Plus Bye Bye by ardor · · Score: 3, Interesting

    If you really understand C++, migrating to C# is very easy. C#->C++ however...

    but, if we talk about managed languages, I'd go straight for Python or Common Lisp.

    --
    This sig does not contain any SCO code.
  15. How good it is, isnt a major plus by cheekyboy · · Score: 1

    Whats the point of something good, when you have a problem and google it and find zero results every single time.

    Search for C++ and find 10000s of results/samples/etc....

    People do more than just back end database integration to web front ends. The day intel implements C# decoding on CPU side to make it as fast
    or faster than native code, that might move a LOT OF mindset to it.

    --
    Liberty freedom are no1, not dicks in suits.
  16. Tool misuse? by mattgreen · · Score: 1

    Why are you using code generation tools to write code that is performance sensitive? Of course you avoid indirection at all costs in code that has to be fast. It would have been equally as slow if you had used pure OO code in C.

  17. Re:C Plus Plus Bye Bye by pzs · · Score: 1


    but, if we talk about managed languages, I'd go straight for Python or Common Lisp.




    I've heard a few people saying this. Is Common Lisp really an industrial strength development tool? I thought it was just for functional programming acolytes and emacs power users.




    Peter


  18. 3...2...1... by kazade84 · · Score: 2, Funny

    and let the syntax criticizing begin ;)

    1. Re:3...2...1... by HappySmileMan · · Score: 1
      C++ syntax sucks...

      I mean

      int a = 5 + 6;
      How the hell is anyone supposed to understand it
    2. Re:3...2...1... by kalaf · · Score: 1

      That's C code.

      C++ has a semicolon at the end of the header file. I'm sure there's a reason for it, but I lost a good two hours trying to get one of my first C++ projects to compile because it was missing. The syntax does suck, but it's not unusable once you learn it.

      Now if you want to talk about crappy syntax, I was just forced to write a small app in VB...

    3. Re:3...2...1... by mikael · · Score: 1

      C++ has a semicolon at the end of the header file. I'm sure there's a reason for it, but I lost a good two hours trying to get one of my first C++ projects to compile because it was missing.

      Did you define a class or structure as the last item in your header file? You always need a semicolon to close the definition of a class.

      If so, they you needed that semicolon to close the definition of that class. Otherwise that completely messes up the syntax
      of the sequence of header files, as the compiler will assume that the next object to be defined (function or class) somehow extends the previous object.

      --
      Vintage computer adverts: http://www.vintageadbrowser.com/computers-and-software-ads
    4. Re:3...2...1... by kalaf · · Score: 1

      Yes, it was a class definition. And yes, I know it's there for a reason. The point is it's a silly little piece of syntax that isn't required in, for instance, Java. Not only that, but the compiler couldn't pick up what the actual issue was, and ended up directing me to the middle of included files I didn't write. This is not an issue for an experienced dev, but this was my first impression of the language and I was fairly new to programming in general. I'm a firm believer that you should be able to pick up a language and write something simple in it without much effort.

  19. not bad... by rgravina · · Score: 5, Interesting

    Recently, I've just started getting into C++, and I can't understand why so many people hate the language with such a passion. The thing is, if you need/want to write your program in a compiled language with plenty of library support, then aside from C, what options are there? I'm not trying to start a flamewar, but I figure if I want to say use C (or other C++) libraries and a compiled language then I feel C++ is much better option than C. One very smart and experienced C programmer I know hates C++ with a passion complaining that "it's too complex" and just rejecting it outright.

    I haven't yet written (or debugged) any large programs in C++, so that could be why I'm still enthusastic. Perhaps after some time with the language I might see what everyone is so worked up about.

    I'm reading through "Effective C++" by Scott Meyers, and although the language seems like it has its warts and complexity, it also offers a great deal of power and is a hell of a lot more fun to program in than C because you get the abstraction support of objects, namespaces etc. Streams - awsome. Shared (reference counting) pointers - awsome. Less need for the preprocessor - awsome. And the standard library (plus Boost too) is so vast... containers, algorithms, it's all there.

    Python is still my favourite general-purpose language, but if I need something compiled, then I don't see what is so bad about C++. Sure, Objective-C is a far better approach to the "lets-make-a-better-C" idea, but I'm not sure how to use it (and the standard library) outside of OSX or GNUStep.

    1. Re:not bad... by Anonymous Coward · · Score: 1, Interesting

      For me, the answer has become D http://www.digitalmars.com/d/index.html

    2. Re:not bad... by Anonymous Coward · · Score: 2, Insightful
      C++ seems to have been designed by someone who hated C.
      C++ is anti-C (should have been named ~C):
      • is complex where C is simple
      • hides what's going on, to the extent that you
        can't tell what's going to happen just by looking at code
        (you have to look way behind the scenes
      • has implementations which are diverging, not converging
    3. Re:not bad... by Random832 · · Score: 4, Funny

      (should have been named ~C) And Godwin's law has been invoked/fulfilled/whatever.

      --
      We've secretly replaced Slashdot with new Folgers Crystals - let's see if it notices.
    4. Re:not bad... by EsbenMoseHansen · · Score: 1

      Recently, I've just started getting into C++, and I can't understand why so many people hate the language with such a passion. The thing is, if you need/want to write your program in a compiled language with plenty of library support, then aside from C, what options are there? I'm not trying to start a flamewar, but I figure if I want to say use C (or other C++) libraries and a compiled language then I feel C++ is much better option than C. One very smart and experienced C programmer I know hates C++ with a passion complaining that "it's too complex" and just rejecting it outright.

      Most of the complaining is just sour grapes. C++ is not a language for everyone, it's powerful and complex. Most programmers should be able to learn basic C++, even Java programmers.

      I haven't yet written (or debugged) any large programs in C++, so that could be why I'm still enthusastic. Perhaps after some time with the language I might see what everyone is so worked up about.

      Debugging is always a mess for any non-trivial problem.You'll learn what to watch out for.

      I'm reading through "Effective C++" by Scott Meyers, and although the language seems like it has its warts and complexity, it also offers a great deal of power and is a hell of a lot more fun to program in than C because you get the abstraction support of objects, namespaces etc. Streams - awsome. Shared (reference counting) pointers - awsome. Less need for the preprocessor - awsome. And the standard library (plus Boost too) is so vast... containers, algorithms, it's all there. C is a nice assembler. Using the right tool is essential; C++ is for building libraries, systems and applications. C is for doing lowlevel stuff :D

      Smart man.. not that I use Python, I prefer ruby and perl, but using the right tools for the right job is, again, smart :)
      --
      Religion is regarded by the common people as true, by the wise as false, and by rulers as useful.
    5. Re:not bad... by odourpreventer · · Score: 2, Insightful

      The problem is that there are so many ways to do things wrong in C++. Writing proper code takes experience. It doesn't help either that monsters like MFC easily mess things up.

      I was going to quit coding C++ when I discovered Boost and wxWidgets. Now I don't want use anything else.

    6. Re:not bad... by rgravina · · Score: 1

      Smart man.. Thanks :) I agree with your post 100%, especially about that point there.
    7. Re:not bad... by rgravina · · Score: 2, Interesting

      D looks very very interesting. I just had to use C++ for my current project for a few reasons (needed to work with wxWidgets and create a library which is accessable from as many languages as possible - so a C++ and maybe a Python wrapper a some point (using SWIG, or Boost.Python, I suppose).

    8. Re:not bad... by rgravina · · Score: 1

      I was going to quit coding C++ when I discovered Boost and wxWidgets. Now I don't want use anything else. In my case I was avoiding C++ until I came across Boost and wxWidgets, and that's what got me into it! How's that for coincidence!
    9. Re:not bad... by CSLarsen · · Score: 1

      C++ being a complex is a real issue. It means you cannot easily write a small parser (like "lint") yourself. It means that getting compilers to produce clean and understandable error messages is hard. It means that metaprogramming is extremely limited. P.S. I like programming in C++, but it *is* messy. I honestly think coding in C is more enjoyable.

      --
      Claiming to be pedantic on Slashdot is asking for trouble
    10. Re:not bad... by Anonymous Coward · · Score: 0

      From my PoV, C++ burdens the language with way too much syntactic cruft with the (failed) goal of preventing bad programmers from making mistakes. I learned C++ first, and after a few years realized that there was nothing I could do in C++ that I couldn't do in C, and in a much cleaner way. Linking into other programs is certainly easier too. The guy who said C++ is for libraries was smoking something. If you have an app written in C, you are hosed if the lib is in C++. The only sane way to deal with it is write a classless wrapper and tweak the linker to export unmangled functions. I regard my experience with C++ as worthwhile, because it reinforced the idea of modularity. I see it as a nice intermediate language. Not once in my roughly 4 years as a professional C programmer have I gotten into any position where I felt "if only this project were C++". And no, it's not all systems programming either, plenty of application level stuff, albeit command-line.

    11. Re:not bad... by m2943 · · Score: 1

      Most of the complaining is just sour grapes. C++ is not a language for everyone, it's powerful and complex. Most programmers should be able to learn basic C++, even Java programmers.

      I have been developing in C++ for 20 years, do most of my development in C++, and I do not claim to understand C++. And I have yet to see a substantial piece of correct C++ code.

      If there are people who have actually learned C++, I have never met them or seen their code.

    12. Re:not bad... by m50d · · Score: 1
      Recently, I've just started getting into C++, and I can't understand why so many people hate the language with such a passion. The thing is, if you need/want to write your program in a compiled language with plenty of library support, then aside from C, what options are there?

      Delphi or OCaml, several implementations of common lisp, and with SWIG you can wrap any library you need for any number of more obscure languages.

      One very smart and experienced C programmer I know hates C++ with a passion complaining that "it's too complex" and just rejecting it outright.In my experience, he's right.

      I haven't yet written (or debugged) any large programs in C++, so that could be why I'm still enthusastic. Perhaps after some time with the language I might see what everyone is so worked up about.

      It's when you try reading (and debugging) someone else's large C++ program, written by someone who knew and used the advanced features, that you'll notice the problems. There are just far too many things in the language to learn easily, too many of which redefine syntax which you thought you knew what it did.

      Streams - awsome. Shared (reference counting) pointers - awsome. Less need for the preprocessor - awsome. And the standard library (plus Boost too) is so vast... containers, algorithms, it's all there.

      It's the vastness that's the problem. The parts of C++ that different people know never entirely overlap (and *no-one* knows the entire language), so when you have half a dozen programmers on a project you end up with everyone only able to maintain their own code.

      --
      I am trolling
    13. Re:not bad... by Rob+Riggs · · Score: 1

      I am going to guess that your experience with C++ is Linux/GCC or Windows/MSVC++.

      Try doing C++ on a Unix platform where GCC is not the default/native compiler and tell me what you think of the language then.

      --
      the growth in cynicism and rebellion has not been without cause
    14. Re:not bad... by superpulpsicle · · Score: 1

      20 years and still missing a full understanding. That sums up the C++ experience.

    15. Re:not bad... by EsbenMoseHansen · · Score: 1

      Most of the complaining is just sour grapes. C++ is not a language for everyone, it's powerful and complex. Most programmers should be able to learn basic C++, even Java programmers.

      I have been developing in C++ for 20 years, do most of my development in C++, and I do not claim to understand C++. And I have yet to see a substantial piece of correct C++ code.

      If there are people who have actually learned C++, I have never met them or seen their code. Well, I believe I have learned C++, which took about 6 months of medium intensity. (Actually, I was fixing bug 1777 on mozilla at the time :) ). Any, go to http://websvn.kde.org/trunk/KDE/kdelibs/. and pick a random class. Then tell me what is not correct about that code. Of course, provable correct is another matter. But if that is your goal, I think Lisp/Haskell and that ilk is more appropriate.
      --
      Religion is regarded by the common people as true, by the wise as false, and by rulers as useful.
    16. Re:not bad... by Kashra · · Score: 1

      I think you've hit the nail on the head for the majority of programmers out there. There's a reason C++ is so dominant in development of just-about-everything(tm). There are a few reasons for the minority to be upset, over this, and they're usually divided into camps:

      (1) The C holdouts. These folks grew up learning C and functional programming. They hold to the misguided belief that C is still a more optimized language and the appropriate choice for most applications. They also believe "struct" is all the OOP you should ever need. Arguments from this camp usually involve how hard it is to make a compiler for C++ ("When I used VC5 back in 1842, it didn't even compile my for loops correctly") and on application size ("I included the entire standard library because I thought it was required and now I can't fit my 2MB executable on my 5.25" floppy").

      (2) The Objective-C people. These folks decided to learn Objective-C instead of C++, when growing out of C. Usually because Apple told them to. Their arguments usually focus on how C++ is too flexible and isn't a true OOP language ("Objective-C is far more intuitive and straightforward than C++ ever will be, like my iBook!")

      (3) The Java people. These folks believe that, if you're going to get more complicated than C, you may as well go all out. They want all the bells and whistles, and believe that C++ provides all the complexity with none of the features. Their arguments almost always start with garbage collection and proceed on to Objective-C style arguments about being a true OOP language ("Why bother freeing your own memory? Let the computer guess what you want, that's what they're there for.")

      (4) The idealists. Finally, these folks believe that there is some other, ideal language that roughly nobody uses for anything but would cure global warming, disarm our nuclear arsenal and mix a mean screwdriver while it was at it. They attack C++ mainly because, if their new order is to take over, the evil giant that currently oppresses them must be the first to fall ("Just because its popular doesn't mean its good! In fact, it means it must be crap and I refuse to use it.")

      I hope this provides some insight into this small subset of the programming community. Rest assured that most of us DO use C++ or some extension of it, for many tasks, and are perfectly satisfied with it. I won't say C++ is the LAST language I'll ever use, I think that there's room for improvement and I'm sure there's another language that will replace it, eventually.

      --
      If you can't find a real troll, just mod down whoever you don't agree with!
    17. Re:not bad... by jez9999 · · Score: 1

      I haven't yet written (or debugged) any large programs in C++, so that could be why I'm still enthusastic. Perhaps after some time with the language I might see what everyone is so worked up about.

      If you want a good example, have a look at some of the Mozilla source code. Virtually everything has a layer of abstraction beneath it using various methods such as templates, preprocessor macros, and typedefs. This is apparently so it can be multiplatform, through an object model called XPCOM. The trouble is, C++ may have the ability to be 'multiplatform', but it necessarily involves almost learning a new COM language to be able to do it because of the inherent differences in various platforms.

      I'd rather have something higher level like Java, whose VM sorts out the irritating platform differences.

      Disclaimer: I have submitted some significant patches to the Mozilla source.

    18. Re:not bad... by 19thNervousBreakdown · · Score: 1

      No! Don't fix bug 1777! That's the source of my (and everyone else's) super powers!

      Damnit.

      --
      <xml><I><am><so><damn>Web 2.0</damn></so></am></I></xml>
    19. Re:not bad... by fenderized · · Score: 1
      Two slight nitpicks,

      (1) The C holdouts. These folks grew up learning C and functional programming. Within the context, I think you mean procedural programming. Functional programming would be a better fit under point 4.
      And regarding your sig,

      If you can't find a real troll, just mod down whoever you don't agree with! Your post wasn't trolling, but rather flamebait ;)
    20. Re:not bad... by scotch · · Score: 1

      (and *no-one* knows the entire language)

      I know the entire language, for a pretty useful value of "all" (let's say 95%+).

      --
      XML causes global warming.
    21. Re:not bad... by m2943 · · Score: 1

      Then tell me what is not correct about that code.

      Here you go.

      Well, I believe I have learned C++, which took about 6 months of medium intensity.

      So, you claim you know all the rules and definition in ISO/ANSI C++? You can tell exactly which constructs are implementation defined and undefined? You know the entire STL API, complexities, etc.? You know the entire C99 subset, and its rules and definitions? I really doubt it.

      What you probably mean is that, after 6 months of studying, you can produce useful code in C++ that seems to work on your desktop machine. That's nice, but it's just enough to get you into trouble.

    22. Re:not bad... by Anonymous Coward · · Score: 1, Insightful

      Two mediocre programmers chiming in does not a bad language make. I'm sorry but someone who's worked with a language for 20 years and still hasn't learned it, well, you guys should stick with VB or Java or whatever the new COBOL is these days. Languages for non-technical people such as yourselves.

    23. Re:not bad... by EsbenMoseHansen · · Score: 1

      Then tell me what is not correct about that code.

      Here you go.
      No examples? So that's a no, then, you couldn't find anything in a random class? So you original statement was false, it is actually pretty easy to produce correct C++ code. I thought so, thanks for clearing that up. Yes, there are bugs, but that is always the case with any language I have ever heard of.

      Well, I believe I have learned C++, which took about 6 months of medium intensity.

      So, you claim you know all the rules and definition in ISO/ANSI C++? Well, not by heart, but I know enough to know when to look up the details.

      You can tell exactly which constructs are implementation defined and undefined? yes

      You know the entire STL API, complexities, etc.? Yes, for any reasonable value of "know". There are a few binders and algorithms I rarely use, though.

      You know the entire C99 subset, and its rules and definitions? I really doubt it. Most of it. I don't use this part very much, though, so there might well be corners I don't know that well.

      What you probably mean is that, after 6 months of studying, you can produce useful code in C++ that seems to work on your desktop machine. That's nice, but it's just enough to get you into trouble. Hah. The code I wrote then runs on all the platforms Mozilla runs on. The code I wrote after that currently runs on Z/OS, windows and Linux. These days, I write code on Linux, but intended to work on windows too when the time come. Sure, I've made mistakes, and bugs, but those mostly comes from typing mistakes and such. So yes, I maintain that if you cannot learn enough C++ to stay out of harms way you are not a very good programmer. Sorry.
      --
      Religion is regarded by the common people as true, by the wise as false, and by rulers as useful.
    24. Re:not bad... by m2943 · · Score: 1

      No examples? So that's a no, then, you couldn't find anything in a random class? So you original statement was false, it is actually pretty easy to produce correct C++ code.

      No, the original statement was true and I demonstrated it: C++ source code has lots of bugs (as demonstrated by the bug list).

      The fact that you think that bugs can be spotted at the level of a single class is itself telling and shows that you really don't have an inkling of what is going on. One of the big problems with C++ is exactly that the meaning and behavior of code can be changed in so many arbitrary ways by other code.

      But since you asked, here's an arbitrary method (first one I picked, I really wasn't looking for anything specific):


      void HTMLDocumentImpl::setCookie( const DOMString & value )
      {
              WId windowId = 0;
              KHTMLView *v = view ();

              if ( v && v->topLevelWidget() )
                  windowId = v->topLevelWidget()->winId();

              QString fake_header("Set-Cookie: ");
              fake_header.append(value.string().toLatin1().const Data());
              fake_header.append("\n");
              QDBusInterface *kcookiejar = new QDBusInterface("org.kde.kded", "/modules/kcookiejar",
                                                                                                              "org.kde.KCookieServer");
              if (!kcookiejar->isValid())
              { // Maybe it wasn't running (e.g. we're opening local html files)
                      QDBusInterface("org.kde.kded", "/kded", "org.kde.kded").call("loadModule", QByteArray("kcookiejar"));
                      delete kcookiejar;
                      kcookiejar = new QDBusInterface("org.kde.kded", "/modules/kcookiejar",
                                                                                      "org.kde.KCookieServer");
              }

              kcookiejar->call(QDBus::NoBlock, "addCookies",
                                                URL().url(), fake_header, qlonglong(windowId));

              delete kcookiejar;
      }


      Assuming standard definitions for "new", this code has several places where it can (and will) leak memory. It also depends on unportable features. Beyond that, it's impossible to tell what this code does, let alone whether it does it correctly; depending on header files and other compilation units, this piece of code can do arbitrary things: crash, alter any memory location, alter any variable in any other namespace, etc. The meaning of the code may change depending on whether you remember to include a header file or not, and if you don't include it, it may still compile without warning.

      I also couldn't find any unit tests for this code, so this code probably hasn't even been unit tested.

      Well, not by heart, but I know enough to know when to look up the details. [...] Most of it. I don't use this part very much, though, so there might well be corners I don't know that well.

      You don't even know enough to understand how much trouble you're in.

    25. Re:not bad... by Kashra · · Score: 1

      Procedural. Yes that's what I was looking for. :)

      And now that I read it, I suppose a mod of flamebait wouldn't be unfair. But it certainly is fun to go through all the other comments and assign them into my categories, see which one wins!

      --
      If you can't find a real troll, just mod down whoever you don't agree with!
    26. Re:not bad... by Raenex · · Score: 1

      There's a reason C++ is so dominant in development of just-about-everything(tm). I think you're far over-estimating how many people use C++. C++ lost to Java in the enterprise. Tons of applications are written in VB or C# nowadays. Tons of stuff is written in PHP, Ruby, Python, Perl, etc. And C is still the lingua franca of programming languages.

      The C holdouts. C is good if you don't need all the complexity of C++ and want portability, small size, and speed.

      The Java people. These folks believe that, if you're going to get more complicated than C, you may as well go all out. Java removed a lot of the complexity of C++, and a whole class of memory bugs.

      The idealists. Finally, these folks believe that there is some other, ideal language that roughly nobody uses for anything A language has to start somewhere. Unless you think "C++ forever", a great new language will come from idealists.

      I hope this provides some insight into this small subset of the programming community. Do some research on language numbers. C++ is still a major player, but there are other major players. Really, the only stranglehold C++ has is in game development.
    27. Re:not bad... by EsbenMoseHansen · · Score: 1

      original statement was true and I demonstrated it: C++ source code has lots of bugs (as demonstrated by the bug list).

      Sorry for the provocation, but I had to flush out a real example to know what your beef is. It worked, too :p Any project of significant size have hordes of bug reports and another horde of bugs. Sometimes, they even overlap. This has nothing to do with the language, unless you know a language where this doesn't occur? I know firsthand that C, Fortran, PL/I, Java, Perl, Python, ECMAscript and Ruby are all prone to errors. I have only dabbled in Lisp, Haskell and prolog, but they seemed equally prone.

      Now, to the specific point

      The fact that you think that bugs can be spotted at the level of a single class is itself telling and shows that you really don't have an inkling of what is going on. One of the big problems with C++ is exactly that the meaning and behavior of code can be changed in so many arbitrary ways by other code.

      I am well aware of this. I didn't link to a specific class, I linked to an entire project. But usually, the bug can be demonstrated to be pretty localized, even though the cause is in the interaction between several classes.

      But since you asked, here's an arbitrary method (first one I picked, I really wasn't looking for anything specific):

      [snipped code, look to parent] Assuming standard definitions for "new", this code has several places where it can (and will) leak memory.

      If some called function threw an exception, sure, which is why I'd use an std::auto_ptr rather than the raw point. But: KDE does not use exceptions, nor does Qt. So the only place left would be if the second new operator threw an exception. Possible, but I doubt anything would catch that particular exception, so the application would probably terminate at that point, which is not an unreasonable behaviour if out of memory. Not ideal, but since the applications are so rarely informed when they are out of memory in these days and times, the cost/benefit of attempting a recover just isn't favorable.

      It also depends on unportable features.

      KDE is an X-only application. It is exactly as portable as it should be.

      Beyond that, it's impossible to tell what this code does, let alone whether it does it correctly; depending on header files and other compilation units, this piece of code can do arbitrary things: crash, alter any memory location, alter any variable in any other namespace, etc. The meaning of the code may change depending on whether you remember to include a header file or not, and if you don't include it, it may still compile without warning.

      Ok, so I guess that's your real beef, and not a stupid one at that. But: It is true that you can pretty much redefine your code to do anything you like (although inspection of the included files would reveal this). This is one of the features I particularily like; having the language adapt to the domain is far more important to me. (Which might be why I like ruby but dislike Java). Anyway, if I e.g. define a function called "add_2_integers" which actually multiplied in say Java, the user would still be surprised. Limiting the language to avoid surprises is a hopeless endeavor, which I'd advice against.

      I also couldn't find any unit tests for this code, so this code probably hasn't even been unit tested.

      I wouldn't be surprised. In practice, unit tests are not written in any language, and when they are, they are incomplete. It's a nice idea, it just doesn't work that way. Open source, however, is a proven method of flushing out bugs, that works on more than just paper.

      Well, not by heart, but I know enough to know when to look up the details. [...] Most of it. I don't use this part very much, though, so there might well be corners I don't know that well.

      You don't even know enough to understand how m

      --
      Religion is regarded by the common people as true, by the wise as false, and by rulers as useful.
    28. Re:not bad... by Kashra · · Score: 1

      Yes, in fact I believe my post was quite clearly a C++ forever post. Thank you for pointing that out, for anyone who might have missed it. ("...I won't say C++ is the LAST language I'll ever use, I think that there's room for improvement...")

      I suppose I hadn't considered the fact that some people, such as yourself, might fall into ALL of the categories, at once. Congratulations! You have bested me.

      I have nothing against any of these groups (except perhaps the C holdouts, most of them can crawl back into the cave they code in). I'm simply pointing out the ludicrous nature of their arguments against a very solid language that has been widely adopted for good reasons.

      I don't consider C++ to have won or lost anything against Java, VB, C# and I certainly don't consider it to even be competing with scripting languages like the amazing Python or the over-hyped Ruby or the antiquated but venerable Perl. That's like saying "C++ is used for less shell scripts than Bash." They're not even intended for the same purpose.

      Finally, if you find yourself getting worked up about all this, you've missed the entire point of my original post. It is satire, and though it might sting when it happens to be aimed at you, its a valuable skill to learn to laugh at yourself.

      --
      If you can't find a real troll, just mod down whoever you don't agree with!
    29. Re:not bad... by Anonymous Coward · · Score: 0

      Try doing C++ on a Unix platform where GCC is not the default/native compiler and tell me what you think of the language then.

      Well, I'd be willing to tell you what I think about the relevant compiler(s)....

      - T

    30. Re:not bad... by Anonymous Coward · · Score: 0

      You know the entire C99 subset, and its rules and definitions?

      Minor nit: The current ISO C++ Standard incorporates the C89 Standard, not C99.

      - T

    31. Re:not bad... by Raenex · · Score: 1

      It's hard to tell the difference between satire and just the same old ludicrous arguments you accuse others of. Especially when you make statements like "There's a reason C++ is so dominant in development of just-about-everything(tm)." I can't tell if you believe this is true or not. From the tone of your post you just sound like a C++ zealot railing against those who disparage your language.

      If you really were going for satire, sorry, it doesn't work. I don't think you'll read my post and laugh at yourself, either.

    32. Re:not bad... by m2943 · · Score: 1

      Not ideal, but since the applications are so rarely informed when they are out of memory in these days and times

      That's an incorrect assumption; desktop machines run out of memory all the time, and when they do, this kind of code loses data.

      KDE is an X-only application. It is exactly as portable as it should be.

      This code fails on lots of platforms on which X runs.

      Limiting the language to avoid surprises is a hopeless endeavor, which I'd advice against.

      This isn't about "surprises", it's about the fact that in C/C++, you simply cannot reason reliably about programs; writing robust programs in C/C++ is enormously hard and unnecessarily expensive.

      But I would like to hear what you suggest in it's stead?

      Most languages other than C/C++/Objective-C.

      To get my job done, I need a powerful language, not a nanny nor a straightjacket.

      You actually sound like exactly the kind of person who needs a straightjacket. But, in any case, plenty of languages are as powerful as C/C++ but without the defects.

    33. Re:not bad... by EsbenMoseHansen · · Score: 1

      Not ideal, but since the applications are so rarely informed when they are out of memory in these days and times

      That's an incorrect assumption; desktop machines run out of memory all the time, and when they do, this kind of code loses data.

      Sorry, sir, it is you who are mistaken. When a modern desktop runs out of memory, the kernel doesn't sit around just failing new allocations, unless you have configured your kernel very unusually. It sends kill 9 to a suitable process. On linux, that would be the OOM killer. It does this because it overcommits memory.. it allows processes to allocate memory as they like, but if a page fault occur and there is no available page in swap or memory, it has a problem. The only realistic case where that exception matters is if someone has set ulimit, which is very rare on desktops, in my experience.

      KDE is an X-only application. It is exactly as portable as it should be.

      This code fails on lots of platforms on which X runs. Undoubtedly. Does it fail on any where KDE runs? I only remember seeing X-specific things at a glance, but of course I might have missed some. Portability as an tricky issue, in any language. Of course, so far, it has mostly been you who missed things :) E.g, Java programs are usually not crossplatform, despite all the sacrifices that the language developers have made in an attempt to acheive this.

      Limiting the language to avoid surprises is a hopeless endeavor, which I'd advice against.

      This isn't about "surprises", it's about the fact that in C/C++, you simply cannot reason reliably about programs; writing robust programs in C/C++ is enormously hard and unnecessarily expensive.

      So you keep saying. It is not my experience.

      But I would like to hear what you suggest in it's stead?

      Most languages other than C/C++/Objective-C.

      Ok, so you really don't know what you are talking about. There are a ton of languages which are very much like C or C++ (Java comes to mind, but is somewhat worse). Other are not so like (e.g. ruby) but have plenty of power to essentially create a domain specific language inline. You probably have a specific language in mind... I'm guessing Java. People who hate C++ tends to like Java, most be that conforting straighjacket feel.

      To get my job done, I need a powerful language, not a nanny nor a straightjacket.

      You actually sound like exactly the kind of person who needs a straightjacket. But, in any case, plenty of languages are as powerful as C/C++ but without the defects.

      So you say, but give no examples. I know that is untrue of Java, PL/I, Fortran, Cobol at least, and that was on your, eh, list. You seem to have just looked yourself mad at a language, with no real reason for, which might be why you are unable to articulate a real problem with c++ (I have no problem doing that, btw, it's just that the alternatives are worse). And I don't need a straightjacket, am I valued where I am exactly because I don't need a straightjacket. My designs are solid, and using my code is not a nasty surprise. I do not employ advanced techniques unless there is a substantial benefit, so please stop your unfounded accusations.

      This will be my last word, since I'm going on holidays. Have a nice day :)

      --
      Religion is regarded by the common people as true, by the wise as false, and by rulers as useful.
    34. Re:not bad... by Anonymous Coward · · Score: 0

      Sorry, sir, it is you who are mistaken. When a modern desktop runs out of memory, the kernel doesn't sit around just failing new allocations, unless you have configured your kernel very unusually. It sends kill 9 to a suitable process.

      Wrong. When there is no more memory, the brk() call fails and the C/C++ library can do whatever it needs to to recover. The kernel only starts killing processes when there is no other option.

      There are a ton of languages which are very much like C or C++ (Java comes to mind, but is somewhat worse).

      Errors in Java are nothing like C or C++; for example, unlike C/C++, in Java, there is no way to change the value of a location to which you have no reference, and Java has almost no undefined effects.

      I do not employ advanced techniques unless there is a substantial benefit, so please stop your unfounded accusations.

      Your problem is with basic techniques: in your comments above, you again have shown that you simply do not know what's going on under the hood, and you have shown that as a result you make incorrect choices about error handling and recovery.

      But what's there to argue? The numerous security holes, buffer overflows, data corruption, and crashes in C/C++ software speak for themselves. Programs written in other languages, of course, aren't bug-free, but entire categories of bugs that occur in C/C++ simply don't exist in languages like Java.

    35. Re:not bad... by Bill+Dog · · Score: 1

      That's not C++. I'm sure it compiles as C++, but the programming style is Java's -- objects created on the heap. And the use of bare nekkid pointers is C style, not C++ style.

      I think that because the syntax between these kinds of languages is so similar:
      1) That programmer fooled himself into believing that he was a C++ programmer, and
      2) He also fooled you.

      --
      Attention zealots and haters: 00100 00100
  20. Re:C Plus Plus Bye Bye by Zekasu · · Score: 1

    I've personally heard from a friend that Lisp is pretty damn powerful, particularly in the terms of calcuations and the like, so I can see it being used for some backend applications. Although, I personally find Lisp more obscure than C++, or C#, but that's just me.

  21. Re:C Plus Plus Bye Bye by Anonymous Coward · · Score: 1, Funny

    This is slashdot, a magical land where functional languages are popular and scripting languages are fast...

  22. Watch the video by dysfunct · · Score: 2, Interesting

    As an autodidact I'm easily bored by overly long and dry technical presentations of what could be read through in a couple of minutes, but this video is getting very interesting and funny after the first couple if minutes. Lots of insight into the process of creating the new standards and and all the thoughts that go into it, mixed with anecdotes, random trivia and geek humor by Bjarne Stroustrup himself. I'm actually considering downloading the 700mb xvid version of the talk and making me some popcorn to go with it. IMO, even if you're not a C++ geek it's actually worth watching.

    --
    :/- spoon(_).
  23. The Future Is Already Here... by ezdude · · Score: 2, Funny

    And it looks something like Haskell. Static typing, lazy evaluation, high-level parallelism, pure functionality, explicit imperative-ness. Heck, monads even sound like something from the future.

    1. Re:The Future Is Already Here... by Anonymous Coward · · Score: 0

      enjoy your distraction. :)

    2. Re:The Future Is Already Here... by Anonymous Coward · · Score: 1, Interesting

      Until it can support Lisp style macros, it's just a sad little subset of Lisp, much like Python* or Ruby* or F#...

      Have a project that would actually get much benefit from lazy evaluation and static typing? Lisp does both just fine, use macros to define a DSL in about 20 minutes. I do it often enough to get static typing so the compiler** can optimize things better that I saved it as an asdf system and just have Lisp load it at startup.

      And just as often, dynamic typing is the obvious way to go. Same applies to lazy eval, sometimes it makes sense, sometimes not (and thank god for it when it does).

      And monads? A hack that admits for most projects outside of academia you need state to Get Shit Done. Even if it makes sense to write a portion or all of the project in a purely functional style, once again Lisp handles that without a second thought. It's simply a matter of not using assignment.
      And if you're really that addicted to them (they *do* have some nice qualities), once again it's a simple matter of macros.

      Parallelism? That's one of the things functional style makes sense for. Big deal *shrugs*.

      Your "future" has already been here for half a century. Everyone else is just catching up, implementing more and more of Lisp as they go.

      *I wish there were something like Slime for Python or Ruby, when I'm forced to use these weird halfhearted Lisp clones for bill paying purposes.

      **Compiling to raw machine code mind you, much like Haskell can be native or VM. Lisp hasn't been purely interpreted in fucking eons. Admittedly, GHC's Haskell -> C translation is pretty slick, but most Lisp users don't have a need for it, and heavy work is long underway for those that do (CLiCC for Common Lisp, Chicken for Scheme, among others for both), or quite often any given CL system will happily save a core image that bundles the "runtime" (what's the proper word for this?) needed, or there's ECL or such.

      And as a side note, I'm eager to see what becomes of Scheme when R6RS is final. Its tail recursion, call/cc, cleaner syntax, etc... have been sexy as hell for quite some time but without a standard method for handling packages/libraries it has remained barely an academic blip in the Lisp world. I can easily imagine Common Lisp becoming regarded as basically a Scheme that already has a set of popular libraries loaded.

    3. Re:The Future Is Already Here... by ezdude · · Score: 1

      "Parallelism? That's one of the things functional style makes sense for. Big deal *shrugs*" Big deal? Yep, big deal. Programming hasn't really changed for decades. This shift to parallelism is the biggest thing on the horizon, and any "future language" had better come equipped. Haskell...and I'll throw in Erlang...appear to be the two most important > languages that will influence the paradigm shift. Lisp? Yeah, I have nothing against Lisp, although I don't know it well. It's not pure. It's not statically typed. It seems to me those are disadvantages to parallelism. As I alluded to earlier, the future may not be Haskell - but it will look something like it. (Maybe with uglier syntax, though.)

  24. C++ needed improvements several years ago. by Futurepower(R) · · Score: 3, Informative

    Dr. Stroustrup made a great contribution by designing the C++ language. However, in recent years it seems to me that he has been taking a leisurely approach to making improvements.

    Stroustrup is, unlike most programmers, an excellent writer. His FAQ is an example. Quote: "What's a good certification for C++ programmers? To the best of my knowledge, there isn't a good certification program for C++ programmers. That's a pity. A good certification program would be most useful. However, C++ lacks the central organization that would produce a solid certification program, and a certification program without authority or that focused on syntax would be worse than useless."

    I'm certainly not an expert in this subject. However, I get the same impression from the words "C++ lacks the central organization" in that paragraph that I get from his other recent work. Something like, "What, me be a leader?"

    Note that Java and C#, which are sometimes seen as replacements for C++, are proprietary languages from companies that are routinely mismanaged. If you use those languages, you partner with those companies, and it is possible that you too will suffer from their mismanagement. For that reason, there is a big need for strong leadership in maintaining a language unencumbered by issues of proprietary behavior.

    Concerning Java, Dr. Stroustrup says "Java isn't platform independent; it is a platform. Like Windows, it is a proprietary commercial platform. That is, you can write programs for Windows/Intel or Java/JVM, and in each case you are writing code for a platform owned by a single corporation and tweaked for the commercial benefit of that corporation."

    Concerning C#, he says, "It will take a lot to persuade me that the world needs yet another proprietary language (YAPL). It will be especially hard to persuade me that it needs a language that is closely integrated with a specific proprietary operating system."

    Again, I'm not an expert in this area, but it seems to me that Dr. Stroustrup tends to define his leadership narrowly and concern himself with programming constructs rather than larger issues such as extension, standardization, and certification of libraries, for example. About C++ garbage collection he says, partly: "See ... Hans-J. Boehm's site". It seems to me that there are too many areas in which the C++ answer is "You can just go there", rather than "This is the standard, certified method."

    It's amazing to me, but true leaders are very rare. After all these years, we still depend on Dr. Stroustrup, even though he has been less than a complete leader in the more social aspects of developing the C++ language, in my opinion.

    1. Re:C++ needed improvements several years ago. by Anonymous Coward · · Score: 0

      Note that Java and C#, which are sometimes seen as replacements for C++,... They are... what? Who... what?
      What sick mind would look at Java or C# as a replacement for C++?
    2. Re:C++ needed improvements several years ago. by teknopurge · · Score: 2, Insightful

      Concerning Java, Dr. Stroustrup says "Java isn't platform independent; it is a platform. Like Windows, it is a proprietary commercial platform. That is, you can write programs for Windows/Intel or Java/JVM, and in each case you are writing code for a platform owned by a single corporation and tweaked for the commercial benefit of that corporation." Boy, he must be very happy about openJDK. I wonder what his next gripe will be about Java?
    3. Re:C++ needed improvements several years ago. by oliderid · · Score: 1

      Concerning C#, he says [att.com], "It will take a lot to persuade me that the world needs yet another proprietary language (YAPL). It will be especially hard to persuade me that it needs a language that is closely integrated with a specific proprietary operating system."

      I'm currently working on C# mono project totally based on Linux (SUSE). If you don't play with windows.Form (the mono version is still under heavy development) and not Windows based UI in general, there is no problem...especially for server-side apps.

      The code will be totally portable between linux and Windows (and probably mac too).

    4. Re:C++ needed improvements several years ago. by Vexorian · · Score: 1

      MONO : YAPLC (Yet another proprietary language clone)

      --

      Copyright infringement is "piracy" in the same way DRM is "consumer rape"
    5. Re:C++ needed improvements several years ago. by canuck57 · · Score: 2, Insightful

      Again, I'm not an expert in this area, but it seems to me that Dr. Stroustrup tends to define his leadership narrowly and concern himself with programming constructs rather than larger issues such as extension, standardization, and certification of libraries, for example. About C++ garbage collection he says, partly: "See ... Hans-J. Boehm's site [att.com]". It seems to me that there are too many areas in which the C++ answer is "You can just go there", rather than "This is the standard, certified method."

      You left out his quip about how C# and Java leave twice as many resources open at run time and something about sloppy programing. A run time GC is not something I believe is needed in C++. If you want that, write it in Java and live with the associated bloat. Or pull in someones library that does the same thing. An example: http://www.hpl.hp.com/personal/Hans_Boehm/gc/

      What all programmers can't seem to get through their heads is that it takes years to become "proficient" at any language. Once proficient you then understand why things were done the way they were done. Most critics of C++ wish they had learned it or perhaps spent 1 month with it and thought they were experts at critique.

      What mystifies me is the masses often get sucked into propriety closed languages/tools like VB, NET, C# (C-Pound) and others. Trouble is, by the time they actually get proficient the vendor will change the API. To a lesser extent this applies to Perl, Ruby, PHP etc also. And off you are wasting time on relearn tools. Which is why I decided early on to learn C right down to the bootstrap code early on. And later learned C++. Not an easy road, but I spend now spend far less time learning tools and much more time punching performance code.

      Call me nuts if you will, but I like C/C++. And suspect, like Dr. Stroustrup does, they have been predicting the 2 year demise in C++ for 12 years and it is still with us. Sun likes Java because it sells big servers to run that bloat ware. Who is kidding who?

    6. Re:C++ needed improvements several years ago. by roman_mir · · Score: 3, Interesting

      Concerning Java, Dr. Stroustrup says "Java isn't platform independent; it is a platform. Like Windows, it is a proprietary commercial platform. That is, you can write programs for Windows/Intel or Java/JVM, and in each case you are writing code for a platform owned by a single corporation and tweaked for the commercial benefit of that corporation." - shouldn't this count for a Flamebait at this point, that Java is Free Sourced?

    7. Re:C++ needed improvements several years ago. by truesaer · · Score: 1
      It's amazing to me, but true leaders are very rare. After all these years, we still depend on Dr. Stroustrup, even though he has been less than a complete leader in the more social aspects of developing the C++ language, in my opinion.


      I think you underestimate how much effort all of this centralization and standardization would require. A few dozen people working full time, at a minimum I would think.


      And besides, Stroustroup is an employee of a big corporation, they're only going to do something like that if there's profit in it. Clearly there isn't. He's also more of a researcher, why would he want to become an administrator of a giant mundane programmer certification organization?


      I guess my point is, the reason there are so few leaders out there is because there isn't money or fun or stature to be gained so why would anyone be interested in it?

    8. Re:C++ needed improvements several years ago. by Anonymous Coward · · Score: 0

      The code will be totally portable between linux and Windows until MS decides to change things about a bit.
    9. Re:C++ needed improvements several years ago. by Constantine+XVI · · Score: 1

      Mono is about as much of a clone of .NET C# as G++ is a clone of Borland Turbo C++. C# is a ECMA standard, open to implement by anyone. It's the Win.Forms and ASP.NET bits (and a few other bits I can't think of) that are proprietary.

      --
      "I think an etch-a-sketch with an ethernet port would beat IE7 in web standards compliance."
    10. Re:C++ needed improvements several years ago. by Anonymous Coward · · Score: 0

      If you don't play with windows.Form (the mono version is still under heavy development) and not Windows based UI in general, there is no problem...especially for server-side apps.

      Oh, there's problems. Patent problems. Mono is saturated with patent violations. These are real patent violations not mythical ones like the Linux kernel is alleged to have. Not even a basic "Hello, world" app is patent-safe.

      M$ will eventually cash in this trojan horse. I for one will be glad when this happens. Purity will be finally restored to the FOSS platform. Mono developers will be the open source equivalent of VB6 programmers: trusting dumbasses who bought M$'s bullshit and then got raped.
    11. Re:C++ needed improvements several years ago. by weicco · · Score: 1

      Note that Java and C#, which are sometimes seen as replacements for C++, are proprietary languages

      If it's standardized, can it be proprietary?

      --
      You don't know what you don't know.
    12. Re:C++ needed improvements several years ago. by dave1g · · Score: 1

      I agree.

    13. Re:C++ needed improvements several years ago. by usrusr · · Score: 1

      Anybody who takes C++ as an all-purpose language would see Java and C# as potential replacements for most of what he thinks C++ is for.

      Of course, more reasonable people would restrict the application of C++ only to areas where Java and C# fail (low level systems programming) and see no overlap. So the sick mind is not the one who overestimates Java or C#, but the one who overestimates C++. There are still way too many of those.

      --
      [i have an opinion and i am not afraid to use it]
    14. Re:C++ needed improvements several years ago. by m50d · · Score: 1

      But at the moment, openJDK and all the other open java projects are less usable than WINE.

      --
      I am trolling
    15. Re:C++ needed improvements several years ago. by bzipitidoo · · Score: 1

      What all programmers can't seem to get through their heads is that it takes years to become "proficient" at any language.

      Why? I can't get it through my head, because I disagree. First, what do you mean by a language? If you mean the core concepts and paradigms, and the trivia (syntax, mainly), then, for a person trained in these concepts (has a BSCS, for instance), no it doesn't take years. Or, it shouldn't take years. If it does take years, then that's a problem with the language. If on the other hand, by "language" you mean the language plus all the additions, such as the libraries and the environment, then maybe that could take a while. This perception problem is only made worse by libraries being difficult to port to other languages, so that they are tied to a specific language.

      And off you are wasting time on relearn tools.

      But that's exactly why it doesn't take years to become proficient in a language. You said that you focused on C and C++, not some API. Libraries are tools. Proficiency in every corner of something like glibc or the Windows API (somewhere around 60,000 functions, I've heard) really is a years long effort. The 220 or so functions of the Linux kernel is more manageable, but that's only one of thousands of groups of functions that might be useful to know. People can be proficient in C++ without knowing all that.

      --
      Intellectual Property is a monopolistic, selfish, and defective concept. It is "tyranny over the mind of man"
    16. Re:C++ needed improvements several years ago. by Oddscurity · · Score: 1

      Concerning Java, Dr. Stroustrup says "Java isn't platform independent; it is a platform. Like Windows, it is a proprietary commercial platform. That is, you can write programs for Windows/Intel or Java/JVM, and in each case you are writing code for a platform owned by a single corporation and tweaked for the commercial benefit of that corporation." - shouldn't this count for a Flamebait at this point, that Java is Free Sourced? The implementation of the runtime is now Free Sourced, yes. But as to the platform itself, how open is that?

      Just asking, since I haven't paid enough attention to Java to know the answer to it. While the JDK and JRE being Free Sourced is great, I think the point Dr. Stroustrup made was more in regards to the process by which the language and standard library itself (i.e. platform) are extended. If that's an open process these days then yes, it's an outdated gripe.
      --
      Indeed!
    17. Re:C++ needed improvements several years ago. by roman_mir · · Score: 1
    18. Re:C++ needed improvements several years ago. by Kupek · · Score: 1

      The standardization of C++ is a group process, and he is very much a part of that. As another poster pointed out, it's a slow process. It's not him taking a leisurely approach, they're just hard problems, and they're trying to do the Right Thing.

    19. Re:C++ needed improvements several years ago. by jez9999 · · Score: 1

      Trouble is, by the time they actually get proficient the vendor will change the API. To a lesser extent this applies to Perl, Ruby, PHP etc also.

      So, in conclusion, nobody should ever program in anything except C/C++?

    20. Re:C++ needed improvements several years ago. by mqduck · · Score: 1

      C# (C-Pound) It took a long time before I got over calling it C-Hash. *shrug*
      --
      Property is theft.
    21. Re:C++ needed improvements several years ago. by canuck57 · · Score: 1

      So, in conclusion, nobody should ever program in anything except C/C++?

      Not that at all, but quite a bit more should be. The stuff that lasts the longest is.

    22. Re:C++ needed improvements several years ago. by Nynaeve · · Score: 1

      Why? I can't get it through my head, because I disagree. First, what do you mean by a language? If you mean the core concepts and paradigms, and the trivia (syntax, mainly), then, for a person trained in these concepts (has a BSCS, for instance), no it doesn't take years. Or, it shouldn't take years. If it does take years, then that's a problem with the language.

      It shouldn't take years to be proficient, but it does. Stroustrup himself said it takes at least 18 months to become proficient in C++, and he is right. I've programmed in C/C++ for 15 years, and I've seen C++ programmers that are nowhere near proficient even after several years.

      The problem is not the language, it is the programmers. You wouldn't believe how many people don't want to learn something they don't absolutely have to use (like templates). I can count on one hand the number of people I've met in 15 years that were willing to learn.

      If on the other hand, by "language" you mean the language plus all the additions, such as the libraries and the environment, then maybe that could take a while.

      I consider a library and its language to be separate concepts, like Java. You can know Java inside and out but still not know about the multitudes of functions which comprise its library. C++ on the other hand, has a smaller library, thus making it easier to grasp for those willing to make the effort.

    23. Re:C++ needed improvements several years ago. by Anonymous Coward · · Score: 0

      Proficiency in every corner of something like glibc or the Windows API (somewhere around 60,000 functions, I've heard) really is a years long effort. The 220 or so functions of the Linux kernel is more manageable, but that's only one of thousands of groups of functions that might be useful to know. I don't know about you plebs, but I can pick up most APIs as I use them. None of them present extremely hard to understand concepts and are reasonably well designed and documented.
    24. Re:C++ needed improvements several years ago. by oliderid · · Score: 1

      Purity will be finally restored to the FOSS platform

      I feel like a heretic during the Spanish inquisition :-)

      Personally I don't care if it pure or not. All I want is things that works according to the client needs. Welcome in the real world young Jedi.

    25. Re:C++ needed improvements several years ago. by bzipitidoo · · Score: 1

      The problem is not the language, it is the programmers. You wouldn't believe how many people don't want to learn something they don't absolutely have to use (like templates). I can count on one hand the number of people I've met in 15 years that were willing to learn.

      Could be. Other possibilities are that it's not an unwillingness to learn, it's an unwillingness to "drink from a firehose", or waste time on features of dubious value or merit. People are much more willing to learn if they can learn a little, then use it for real work, then come back for a little more learning, use that, and so on. And, if they can see that the knowledge is useful. Templates is an interesting choice. As something of a hack to get some features of OOP into C++, and something that doesn't exist in Java, I can see people not being too impressed with a need to know all about templates.

      --
      Intellectual Property is a monopolistic, selfish, and defective concept. It is "tyranny over the mind of man"
    26. Re:C++ needed improvements several years ago. by Nynaeve · · Score: 1

      People are much more willing to learn ... if they can see that the knowledge is useful.

      That pretty much sums it up.

      I learn even when I don't know the knowledge is useful. I don't want to risk being one who "knows not, and knows not he knows not." I don't understand how people can survive in IT without that kind of approach; my jobs have been far too demanding for it. Had I not learned templates on my own without a need, I would never have known where they could be applied (and therefore justify the time to learn), and I'd be nowhere near as proficient in C++ as I am now.

      Java has templates. They are called generics.

    27. Re:C++ needed improvements several years ago. by rajkiran_g · · Score: 1

      shouldn't this count for a Flamebait at this point, that Java is Free Sourced?
      No, it shouldn't, because that comment was made way before Sun decided to free java.
  25. Size of iostream? by tepples · · Score: 3, Interesting

    Good afternoon everybody, I would like to start by including iostream.h into the discussion.

    After this we can get onto the main proceedings which might or might not return anything.

    We move to the future by emitting a string of "Hello world" before returning zero.

    This is the end of the discussion I hope it was informative. Yes, all quarter megabyte of it. A Hello World program that uses <iostream> has been seen to take nearly that much space when compiled with g++ and linked statically with GNU libstdc++, on fairly recent versions of both MinGW and devkitARM toolchains. Compare this to an equivalent program that uses only <cstdio>, at under 6 kilobytes each. (Actual source code, binaries, and makefiles are available on request.) This hurts especially on one of the platforms that devkitARM supports, which has only 262,144 bytes of program RAM and no suitable shared library mechanism. There are some people who claim to have reduced libstdc++'s <iostream> overhead by a factor of four, but they're not revealing how they did it other than a vague "RTFM".
    1. Re:Size of iostream? by keesh · · Score: 1

      Do you really expect to get meaningful results when you a) use "Hello world" as your test program and b) static link?

    2. Re:Size of iostream? by tepples · · Score: 2, Informative

      Do you really expect to get meaningful results when you a) use "Hello world" as your test program Yes. A variant of Amdahl's law that applies to code size states that no useful program may be smaller than Hello World. If the Hello World produced with a given implementation of <iostream> is nearly the size of a target platform's RAM, then not much actual functionality will fit in the remaining space.

      and b) static link? The only alternative to static linking that I know of is dynamic linking. Doesn't this require a system to have enough memory to hold the library? As far as I can tell, GNU libstdc++ built as a shared library is larger than the target platform's RAM.
    3. Re:Size of iostream? by Xtravar · · Score: 0, Flamebait

      Why are you programming in C++ for an embedded system?
      All that template garbage is going to inflate the size of your code, and do you really need it? Yeah, the situation sucks, but I don't see why you can't just use C... since it allows you to do leaner things.

      --
      Buckle your ROFL belt, we're in for some LOLs.
    4. Re:Size of iostream? by Old+Wolf · · Score: 1

      All that template garbage is going to inflate the size of your code,

      Oh rubbish. The template code will be the same as, or smaller than, the non-template code. Unless your compiler is truly awful.

      Yeah, the situation sucks, but I don't see why you can't just use C... since it allows you to do leaner things.

      What 'leaner thing' can you do in C but not in C++?

    5. Re:Size of iostream? by jandrese · · Score: 1

      Well, according to one of the earlier posters: You can create a leaner hello world.

      Well, that's not entirely fair, since he's just using a leaner library that you could use in C++, but the point remains that once the STL gets sucked in (since he apparently can't use shared libraries for some reason) your code is going to bloat up a lot faster than if you just grabbed the crusty old stdio stuff from libc.

      Seriously though, if your platform only has 256k of main memory it would be a good idea to set up some sort of shared library mechanism, especially if you're sticking with the unix philosophy of lots of small tools to get the job done. At the very least consider something like Crunchgen to avoid loading duplicate code into memory.

      --

      I read the internet for the articles.
    6. Re:Size of iostream? by swillden · · Score: 1

      as far as I can tell, GNU libstdc++ built as a shared library is larger than the target platform's RAM.

      Shouldn't matter at all, given a reasonable embedded OS (yes, Linux works, suitably configured). Most embedded systems use flash RAM for storage, so you just arrange to have the OS run the code directly from there, rather than loading it into DRAM first. DRAM should be reserved for run-time data, not code. Any decent embedded OS is perfectly capable of this, and it's a pretty rare embedded device these days that is seriously limited in terms of flash RAM, as cheap as it is.

      Your issue is a non-issue. C++ is a great toolset for embedded programming, and all of that code in the standard libraries is there because it makes your code easier to write and more compact. On non-trivial programs, the libstdc++ "bloat" quickly becomes a non-issue (and can actually *save* you in code space) and even more importantly it significantly increases programmer productivity. Programmers cost more than flash in nearly all cases.

      --
      Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
    7. Re:Size of iostream? by edwdig · · Score: 1

      The original poster was taking an odd path to prove his point. He's trying to develop for the GameBoy Advance, which has 256 KB of RAM. But he's also ignoring the fact that 99.9% of the time, code doesn't run from RAM, but rather directly from the cartridge ROM, making the 256 KB mostly irrelevant.

    8. Re:Size of iostream? by gauauu · · Score: 1

      Not entirely true. He spends a lot of effort making things that will work by loading off the link-cable, which has the load the entire game into RAM.

    9. Re:Size of iostream? by norton_I · · Score: 2, Informative

      Oh rubbish. The template code will be the same as, or smaller than, the non-template code. Unless your compiler is truly awful.


      That entirely depends on how you use templates. A single instantiation of a template will likely be smaller than the equivalent generic code, especially in a complex class where you only have to instantiate the members you use. However, if you allow the same code to be instantiated several times, it will quickly blow up your executable size. Any way you avoid this, you quickly lose the benefit of templates (i.e., you make the generic version and lose compile time type-checking). Have you seen the size of executables that heavily use STL? They can be huge.

      What 'leaner thing' can you do in C but not in C++?


      Since most C programs are valid C++ programs, and will compile to a comparable size, almost nothing. However, as soon as you actually *use* non-trivial C++ features, such as the standard library, you are lost on small platforms. Any programming language you can't like with the most basic element of the languages standard library without taking up 90% of your target RAM is... useless (for that target).
    10. Re:Size of iostream? by Cassini2 · · Score: 1

      Oh rubbish. The template code will be the same as, or smaller than, the non-template code. Unless your compiler is truly awful.

      Have you worked with some of these compilers?

      I am still really from:
      162 % 80 = 66
      and
      162 / 80 = -1

      Hint: cast 162 to a signed char before doing the mod 80 operation. Yes, this bug is in a C compiler sold by a major embedded chip company.

    11. Re:Size of iostream? by ultranova · · Score: 1

      He spends a lot of effort making things that will work by loading off the link-cable, which has the load the entire game into RAM.

      Make a Virtual Machine which swaps data and code in and out through the cable as needed ;).

      --

      Forget magic. Any technology distinguishable from divine power is insufficiently advanced.

    12. Re:Size of iostream? by tepples · · Score: 1

      Make a Virtual Machine which swaps data and code in and out through the cable as needed ;). Neal "loopy" Tew already has. It's called "PocketNES for GBA Movie Player", using a bytecode based on 6502 machine language. Programs like Kirby's Adventure slow down unacceptably when they start thrashing the available RAM.
    13. Re:Size of iostream? by tepples · · Score: 1

      But he's also ignoring the fact that 99.9% of the time, code doesn't run from RAM, but rather directly from the cartridge ROM, making the 256 KB mostly irrelevant. The platform I'm talking about is a GBA with a GBA Movie Player, which has 512 KiB of NOR and 1 GiB of NAND. Or are you talking about the NOR flash cards or NAND/DRAM flash cards that are banned on eBay?
    14. Re:Size of iostream? by tepples · · Score: 1

      Seriously though, if your platform only has 256k of main memory it would be a good idea to set up some sort of shared library mechanism Which would require libstdc++.so itself to be significantly smaller than RAM, right? Or are you talking about splitting libstdc++ into multiple overlays?

      At the very least consider something like Crunchgen to avoid loading duplicate code into memory. I'm familiar with the concept of things like Crunchgen. In the past, I have combined multiple activities into compilations such as freepuzzlearena and Luminesweeper, to spread the load of library overhead across multiple activities. But when even a single program nearly fills RAM, that's a different story.
    15. Re:Size of iostream? by Yokaze · · Score: 1

      How about: uclibc? ~100K for the whole library. I assume, you use the embedded c-library newlib in the kit as C-library. So a comparison to an embedded c++ library would be appropriate.

      G++-iostream is optimised for performance on standard computers and includes support for locales. Hardly something, which I'd expect to perform well in a space constrained environment.

      --
      "Between strong and weak, between rich and poor [...], it is freedom which oppresses and the law which sets free"
    16. Re:Size of iostream? by Xtravar · · Score: 1

      Hmm I wasn't trying to be flamebait but apparently I was!

      I don't pretend to be the authority, but when you have to recreate the same function X number of times for different types being passed into it it obviously is going to generate a lot of extra code. For every templated function in C++ you'd need the compiler to generate a new prologue and epilogue for essentially the same code in the middle, just so it's 'type safe'. It's not as little overhead as you think! Especially when you have entire templated classes in C++. Really, why do you need the operator overloaded 20 times when you have printf when working with limited memory?

      I actually worry about this a lot programming for the Windows Mobile / Pocket PC platform with C# of all languages. Even though C# 2.0 has templates, they're created at runtime and then take up space. For the desktop it's completely perfect programming methodology to template everything since you have the memory and processor to handle it, and then the runtime benefits of calling that function are realized. However, for PDAs I've found that using non-generic classes with casting is faster - even though the runtime overhead is slower, the JIT time (which is unrelated to this discussion) and memory space taken up for additional templated classes is not worth it.

      --
      Buckle your ROFL belt, we're in for some LOLs.
    17. Re:Size of iostream? by tepples · · Score: 1

      How about: uclibc? Thank you for the pointer.

      I assume, you use the embedded c-library newlib in the kit as C-library. Yes, devkitARM uses newlib. Would uClibc++ also run on top of MSVCRT (for use with MinGW)?
    18. Re:Size of iostream? by Yokaze · · Score: 1

      > Would uClibc++ also run on top of MSVCRT (for use with MinGW)?

      I have to say, I have no idea.

      --
      "Between strong and weak, between rich and poor [...], it is freedom which oppresses and the law which sets free"
    19. Re:Size of iostream? by Storlek · · Score: 1

      no useful program may be smaller than Hello World That is wildly incorrect! 'true' and 'false' are two commonly used counterexamples.
      --
      Bears don't normally eat things that talk and move backwards.
    20. Re:Size of iostream? by jgrahn · · Score: 1

      Yes, all quarter megabyte of it.

      For you. For normal systems, "Hello, world!" is more like the 5344 bytes I got when I compiled it on my Debian machine.

      Or 4896 bytes on my ppc machine. Hey, that must mean the PowerPC architecture is 8.4% better than AMD64!

      But seriously -- what those 256 kilobytes mean is simply that noone has bothered to optimize the linker and standard library of your toolchain for iostreams. Possibly because too many people think they are too large and don't use them.

    21. Re:Size of iostream? by tepples · · Score: 1

      That is wildly incorrect! 'true' and 'false' are two commonly used counterexamples. If they are not shell builtins.
    22. Re:Size of iostream? by tepples · · Score: 1

      For normal systems, "Hello, world!" is more like the 5344 bytes I got when I compiled it on my Debian machine. Are you counting or not counting the size of libstdc++.so?

      what those 256 kilobytes mean is simply that noone has bothered to optimize the linker and standard library of your toolchain for iostreams. I found a linker optimization that brings it down to 180 kB, and somebody has bothered to optimize <iostream> by making an alternate implementation minus the locale fat, but you're right: it's just that the optimized uClibc++ happens not to be bundled with any popular toolchain. I'll complain less.
    23. Re:Size of iostream? by aevans · · Score: 0

      I think that's the point. g++ is a truly awful compiler, at least for embedded work.

  26. Java: "more than 1000" by zigamorph · · Score: 1
    1. Re:Java: "more than 1000" by EsbenMoseHansen · · Score: 0, Flamebait

      Yeah, there are lots of jobs doing Java. The downside is, you have to work in Java :p Think big financial system, database work, middleware, web backends. And did I mention you have to work in Java? Maybe you can even get to work a bit in JSTL, if you don't find Java limiting enough :P

      --
      Religion is regarded by the common people as true, by the wise as false, and by rulers as useful.
    2. Re:Java: "more than 1000" by Tom9729 · · Score: 1

      Have fun writing a web applet in C++ or C# then. ;)

    3. Re:Java: "more than 1000" by JoshHeitzman · · Score: 1

      Have fun writing an ActiveX control in Java. Not that I'm a fan of web pages with ActiveX controls, Java, or Javascript, considering I have all of that stuff blocked by default so the pages don't work right without having to put my machine at increased risk to attack.

      --
      Software Inventor
    4. Re:Java: "more than 1000" by EsbenMoseHansen · · Score: 1

      Have fun writing a web applet in C++ or C# then. ;)

      Since applets are still stuck in 32bit last I heard, don't blame me if I decline. AJAX apps seem to be the rage these days, though web apps is not my specialty.

      --
      Religion is regarded by the common people as true, by the wise as false, and by rulers as useful.
    5. Re:Java: "more than 1000" by Tom9729 · · Score: 1

      ActiveX is useful for little more than serving as an example of things not to do while programming.

      People are pretty good about Java applets. If anything you should be worried about blocking flash. THAT, people overuse.

    6. Re:Java: "more than 1000" by Tom9729 · · Score: 1

      AJAX is nice. I never said anything against using that. ;)

      My original post was just to point out that C isn't for everything. I never said Java was.

    7. Re:Java: "more than 1000" by EsbenMoseHansen · · Score: 1

      AJAX is nice. I never said anything against using that. ;)

      My original post was just to point out that C isn't for everything. I never said Java was.

      C? I thought we were talking C++. In any case, I heartily agree. I would never code a web app in C++ or C... not when rails or the python-equivalent-whose-name-always-elude-me exists. An java also has it's place, especially as a COBOL replacement, where it really shines.

      --
      Religion is regarded by the common people as true, by the wise as false, and by rulers as useful.
  27. Obligatory quote (his 1998 "interview") by Phatmanotoo · · Score: 1, Troll

    Someone had to mention his other famous interview.

    The way I see C++ these days: it might be your only choice if you are building a mass-market "horizontal" app (like, say, mozilla), and even then I would consider alternatives such as Objective C or plain ANSI C. But for "enterprise" apps, it is absolutely dreadful! Like someone said, it is the language with the most error-inducing features.

    1. Re:Obligatory quote (his 1998 "interview") by Anonymous Coward · · Score: 0

      Someone had to mention his other famous interview

      As it says on the bottom of your link: http://www.nsbasic.com/ce/info/interview.shtml, that interview is a hoax.

    2. Re:Obligatory quote (his 1998 "interview") by Anonymous Coward · · Score: 0

      The interview is a pretty well-known joke. What is scary, though, is how seemingly real it gets after you get to know C++ better!

  28. Replacing C++? by Anonymous+Brave+Guy · · Score: 5, Interesting

    C++ is far too complex yes. But there is nothing that can really replace it. A language which supports functional, generic, procedural, object-oriented programming, with static typing, metaprogramming, and heavily geared towards native building?

    The thing is, most development projects that use C++ today don't need all of that.

    C++ is a fine, pragmatic tool, and I have great admiration for Stroustrup's ability to build such a useful thing. C++ is also a powerful systems programming tool.

    But C++ is not a good language for most application development, which is what a great deal of code written in it really is. I think there are several separate but somewhat related reasons for this.

    One is the safety argument. Most people simply don't need the flexibility/footshootability [delete as applicable] of C++. You need only look at the much-hyped field of garbage collection to see that (a) many professional developers find this one feature useful that they regard Java as superior to C++ for this reason alone, (b) many more professional developers have no clue about the overheads involved (which are almost zero for typical applications using modern approaches to GC implementation), and most importantly (c) a great many developers using languages without GC make mistakes that developers using languages with GC wouldn't. Similar arguments apply to other routine problems, such as pointers/NULL.

    The second is the expressive power argument. Life is too short to be using programming languages with primitive, error-prone control flow constructs, functions that aren't first-order entities, no syntactic support for common data structures, crude macros, header files, etc.

    Third we have the standard library argument. Yes, yes, you can get a C++ library for almost anything. That's not the point. The key word is "standard". Take a look at the huge practical success of Java and Perl, and tell me the vast Java standard library and CPAN have nothing to do with them. Sure, C++'s standard library is, technically, of a higher quality than most. But it still has stupid flaws (string support and IO streams are both fundamentally broken, for example). More seriously, it has stupid gaps. In the 21st century, it's hard to seriously advocate application development in a language with no standardised support for user interfaces, networking, concurrency, file systems, etc. No, I'm not going to spend days trying to find the right non-standard library for me. Non-standard libraries are for solving significant problems, where the difficulty and scope make it worth investing the time to find and hook in someone else's code. They're not for trivia that everyone uses all the time.

    And finally, we have the tools argument. Working with header files sucks, and while just about everyone else is playing with their funky, auto-refactoring, navigation supporting editors, what do we have? VC++ (where refactoring still isn't available in native C++) and Eclipse (which is C++ forced into a Java-like IDE)?

    The really scary thing is that reality bites now. It's not like I'm the first person to identify these practical flaws with using C++ for application development. It's not like other people haven't developed languages and tools with all these improvements already. And yet C++ continues to be one of the most important application programming languages today. Why?

    Momentum. That's why. Building a new programming language with a syntax that doesn't look like C is asking for trouble; just look at the arguments Python sees over whitespace. (Curiously, I've never seen such complaints made about Haskell. Perhaps this shows a difference between the insight of your average professional programmer vs. your average language geek academic?) More to the point, trying to advocate a new programming language for industrial application development that isn't some form of block-structured, OO-based clone is asking for trouble.

    I'm hopeful that over the next few years, as hardwar

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    1. Re:Replacing C++? by Chibi+Merrow · · Score: 1

      (Curiously, I've never seen such complaints made about Haskell. Perhaps this shows a difference between the insight of your average professional programmer vs. your average language geek academic?)

      Mostly because an "average language geek academic" doesn't give a damn about anyone actually ever using their language (or at least anyone but them), and especially not about anyone using it to get any work done. ("Computer Science is no more about computers than astronomy is about telescopes." and all that...)

      But that's just the opinion of an average graphics geek academic.
      --
      Maxim: People cannot follow directions.
      Increases in truth directly with the length of time spent explaining them
    2. Re:Replacing C++? by jez9999 · · Score: 1

      Agree with a lot of what you say, but to compare the Java standard library (well-defined, organized by a central vendor) with CPAN (a plethora of modules to do everything and anything, organized by little more than name, of massively varying quality, some rotting away abandoned whilst others are actively updated) is a bit ridiculous.

      Personally I'd like to see a 'vetted' CPAN with quality, well-maintained modules only. I don't know why people put up with the regular CPAN.

    3. Re:Replacing C++? by Logic+and+Reason · · Score: 1

      The second is the expressive power argument. Life is too short to be using programming languages with primitive, error-prone control flow constructs, functions that aren't first-order entities, no syntactic support for common data structures, crude macros, header files, etc.
      "Primitive, error-prone control flow constructs"? Such as? C++ has the same if/then statements and for/while/do loops that most other languages have, along with exceptions for error handling. Nobody forces you to use switches and gotos (I'm guessing that's what you're referring to) if you don't want to. Foreach would be nice, yes, but it's hardly essential (Java programmers seemed to get along fine without it until recently).

      As for functions not being "first-order entities," that's a consequence of C++ being a statically-typed language that puts performance first (and no, functions in Java are not "first-order," since the RTTI stuff you can do with them is horribly clunky and slow). Not to mention that you have things like functors that can turn functions into real objects with only a class wrapper as code overhead.

      "No syntactic support for common data structures"? I'm not even sure what you're talking about here. What kind of syntactic support do you think C++ lacks? It has operator overloading for things like matrix transformations, associative arrays, string concatenation, etc.

      You don't need to use any "crude macros" unless a library forces you to, and if that's so then you should be complaining about the library, not C++. Macros are generally unnecessary when you have templates at your disposal.

      I'll give you header files, though.
    4. Re:Replacing C++? by Bloater · · Score: 1

      C++ is far too complex yes. But there is nothing that can really replace it. A language which supports functional, generic, procedural, object-oriented programming, with static typing, metaprogramming, and heavily geared towards native building?

      The thing is, most development projects that use C++ today don't need all of that.

      They do, you just don't know what they do, do for example, generic tuple types require metaprogramming, projects where you need to be sure of the quality of your program needs static typing. Generic is just polymorphic functional programming - ie, you don't need to keep writing reams of code introducing different bugs in each different place. Procedural is needed by most humans to describe the composition of many functions (eg Haskell "do" syntax). C++ supports non-native building just fine. You just need a VM to target, see LLVM as an example. I'll grant you the object-oriented problem - no language should focus as much on supporting OO as C++ does.

      But C++ is not a good language for most application development, which is what a great deal of code written in it really is. I think there are several separate but somewhat related reasons for this.

      One is the safety argument. Most people simply don't need the flexibility/footshootability [delete as applicable] of C++. You need only look at the much-hyped field of garbage collection to see that (a) many professional developers find this one feature useful that they regard Java as superior to C++ for this reason alone, (b) many more professional developers have no clue about the overheads involved (which are almost zero for typical applications using modern approaches to GC implementation), and most importantly (c) a great many developers using languages without GC make mistakes that developers using languages with GC wouldn't. Similar arguments apply to other routine problems, such as pointers/NULL.

      I can't use the latest eclipse on my 512M dev machine because of the garbage collection. The java allocator cycles through the mapped memory causing constant paging. This is the behaviour caused by lazy destruction, which is a subset of leaky programming. GC is a leak that instead of causing you program to terminate causes persistent misbehaviour for the full lifecycle of a program instead of only until the first maintenance release after the leak is reported.

      And finally, we have the tools argument. Working with header files sucks, and while just about everyone else is playing with their funky, auto-refactoring, navigation supporting editors, what do we have? VC++ (where refactoring still isn't available in native C++) and Eclipse (which is C++ forced into a Java-like IDE)?

      Huh? Eclipse is like Java?

      The really scary thing is that reality bites now. It's not like I'm the first person to identify these practical flaws with using C++ for application development. It's not like other people haven't developed languages and tools with all these improvements already. And yet C++ continues to be one of the most important application programming languages today. Why?

      Momentum. That's why. Building a new programming language with a syntax that doesn't look like C is asking for trouble; just look at the arguments Python sees over whitespace. (Curiously, I've never seen such complaints made about Haskell. Perhaps this shows a difference between the insight of your average professional programmer vs. your average language geek academic?) More to the point, trying to advocate a new programming language for industrial application development that isn't some form of block-structured, OO-based clone is asking for trouble.

      I hate OO, but I quite like C++ (still needs some work though). C++'s worst feature is that it supports near OO usage (and people taught programming between 1990 and 2001 seem to understand nothing *but* OO - yet it is such an ou

    5. Re:Replacing C++? by Anonymous+Brave+Guy · · Score: 2, Informative

      I think you may be confusing me with either a Java evangelist or a C++ basher. I am neither, but I will go through the various points you raised one by one to clarify what I meant.

      "Primitive, error-prone control flow constructs"? Such as?

      Well, in terms of loops, things like foreach (a real one, not an awkward function template that doesn't work with built-in arrays) and labelled break/continue are no-brainers in any modern procedural language. However, in that area I was really thinking of more powerful things like pattern matching and guards on functions as specific features. Of course, given sufficiently powerful handling of functions or macros, you can effectively define your own control flow constructs, so if you want a forever loop or a generator, you just write it.

      Then there are the OO-related issues, based around polymorphism, virtual function dispatch, and dealing with class and member function templates. Look at the elegant simplicity of Smalltalk or the flexibility of Eiffel and then tell me with a straight face that C++'s manual approach to dealing with inheritance and virtual functions is really the best way we could do things. Hint 1: Function overloading vs. function overriding vs. function hiding and their behaviour with virtual function dispatch are crazy. Hint 2: Template resolution takes many pages to describe in the C++ standard. Hint 3: Virtual destructors, 'nuff said.

      And this is without getting into dealing with concurrency in any way, never mind with higher-level tools than primitive threads and locks. Take a look at Erlang's message passing approach or recent developments in transactional memory in everything from Haskell to .Net-based languages if you want to see how weak the "standard" threads and locks model really is.

      As for functions not being "first-order entities," that's a consequence of C++ being a statically-typed language that puts performance first

      Tell that to OCaml, which manages to combine a powerful type system and high-performance imperative features with a functional programming framework quite effectively. As I noted in my previous post, most projects written using C++ today don't need the fast but unsafe and inexpressive approach. Even those that do don't need it most of the time, which is why hybrid approaches like the one OCaml takes have such potential.

      Not to mention that you have things like functors that can turn functions into real objects with only a class wrapper as code overhead.

      Sorry, but even with the nice tricks in Boost, C++'s support for functional programming is at best mediocre compared to what is common in many other languages today, and I don't just mean the mainly academic ones. Being able to overload operator() and play with templates a bit does not change this, it just makes it slightly less limiting.

      "No syntactic support for common data structures"? I'm not even sure what you're talking about here. What kind of syntactic support do you think C++ lacks?

      Well, try initialising a std::vector with some literal data and see how far you get. This one is so annoying they're actually planning to add a hack to compensate in the next version of the C++ standard.

      But the operator overloading you mentioned, while welcome (Java got this one wrong and just hasn't realised yet), is still quite limited. Want to define a multi-dimensional indexing operator? Better go learn about proxy classes, and template metaprogramming if you don't want to take a significant performance hit while you're doing it. And that's only if your data structure happens to be similar to the array-based built-in stuff. Simple but effective things like the head::tail list notation common in functional languages and amenable to recursive processing through pattern matching are difficult or impossible in C++, even if you create your own classes and overload operators in a re

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    6. Re:Replacing C++? by Anonymous+Brave+Guy · · Score: 1

      They do, you just don't know what they do, do for example, generic tuple types require metaprogramming, projects where you need to be sure of the quality of your program needs static typing.

      Tuples require those things in C++. To swap two variables in Python, you just write a,b=b,a and you're done. To extract function parameters into a tuple in Perl, you just write my ($first, $second, $third) = @_; and you're done.

      I'm not even close to rising to the static typing claim. ;-)

      I can't use the latest eclipse on my 512M dev machine because of the garbage collection. The java allocator cycles through the mapped memory causing constant paging.

      You choose a loaded example. For one thing, you're talking about Java, not GC in general. For another, you're talking about Eclipse, not Java programs in general. Go read a few of the papers that have been published over the past 2-3 years about improved approaches to garbage collection. Things can be multiple orders of magnitude faster than they are today in practice, and things like near-real-time performance are also possible. The fact that industrial Java VMs haven't implemented the improved techniques yet doesn't mean they don't exist.

      Programming in C++ is much more practical when you use funtional programming with function composition, type polymorphism, and its partial support for dependent types instead of OO and object polymorphism.

      Or if that's your preference, you could just use a language designed to support those things, and doing so much better, from the start.

      Don't worry, C++ is getting most of the missing features due next year if we're lucky.

      No, I'm afraid it's not. What C++ is likely to get around 2009 is a lot of library band-aids for problems other languages don't have in the first place. If they get it right, some of those things should eventually make life easier for your average C++ programmer working in industry. But since your average C++ programmer working in industry is working on an established project with established coding standards using a compiler several years old, it will be a long time before any substantial improvements filter through, and the rest of the world will probably have moved on.

      The unfortunate reality is that C++ is being slowly standardised to death, because most of the standards committee are enthusiasts with their own personal interests. It's like your average OSS project: loads of people playing with cool code and a beta release, but hardly anyone writing the tedious but necessary stuff and working on documentation, minor bug fixing, and so on. Without the kind of industrial heavyweight behind it that things like Java and C# have, driving for industrially valuable features and prepared to commit the resources to get them, it seems almost inevitable that C++ will waste away as an application development platform for new projects. Unfortunately, what will replace it is probably those languages with industrial heavyweight marketing machines behind them, and not a new language learning from the decades of experience C++ has given us into developing practical, powerful tools for solving real world problems and combining that with the decades of progress made in other arenas outside the C++ world.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    7. Re:Replacing C++? by Anonymous+Brave+Guy · · Score: 1

      I don't think the comparison is as far-fetched as you make out, to be honest. The Java standard library is big, to be sure, but its quality is highly variable and there have been plenty of cock-ups along the way where they rushed into something and now have to live with it. Why else do you think there is more than one GUI framework? And let's be honest, some of the I/O classes are so unwieldy they make Java itself look concise and elegant.

      Certainly better vetted and centrally co-ordinated repositories have merit. The quality of code in C++'s own Boost library collection is generally pretty high, thanks mainly to the peer review process involved. Things like CPAN don't have that, but even so, they're useful for solving a great many problems. Even without that, when C++ doesn't have any standard support for user interfaces, networking, concurrency, file systems and other everyday programming models — not even a systematic framework that platform-specific implementations could be built on to minimise porting effort and retraining — then almost anything else seems like a huge step up.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    8. Re:Replacing C++? by Bloater · · Score: 1

      They do, you just don't know what they do, do for example, generic tuple types require metaprogramming, projects where you need to be sure of the quality of your program needs static typing.

      Tuples require those things in C++. To swap two variables in Python, you just write a,b=b,a and you're done. To extract function parameters into a tuple in Perl, you just write my ($first, $second, $third) = @_; and you're done.

      Oh, you can have a totally generic and slow tuple type in C++ too, its pretty easy to implement such. The missing thing is something I've been whining about for a while which you show in your example - a syntax for tuplish initialisation and return:


      ~{int x; y.front()} = tuple_returner(params);
      ~{int z; a.front()} = {x, y.front()};

      Not the best, but there's the ever-present back-compatibility problem that C++ will always have

      I'm not even close to rising to the static typing claim. ;-)

      You should, it's a valuable discussion. Unit testing only goes so far in a cost-effective way, static typing can be very useful for checking a variety of things with simple declarative syntax (if a little repetitive sometimes) that doesn't then require equivalent unit tests, and also has a useful documentation effect. Unit tests are, of course, important and highly cost-effective for many things but even then, a language like epigram could relegate them to the most high-level of testing.

      I can't use the latest eclipse on my 512M dev machine because of the garbage collection. The java allocator cycles through the mapped memory causing constant paging.

      You choose a loaded example. For one thing, you're talking about Java, not GC in general. For another, you're talking about Eclipse, not Java programs in general. Go read a few of the papers that have been published over the past 2-3 years about improved approaches to garbage collection. Things can be multiple orders of magnitude faster than they are today in practice, and things like near-real-time performance are also possible. The fact that industrial Java VMs haven't implemented the improved techniques yet doesn't mean they don't exist.

      I choose an important example. The problem is the garbage collector in the Sun VM which is the sort of thing C++ would have to have if it had GC all the while until one of these ideal collectors are implemented - if they can even be implemented such that it is easy for the developer (read as "cheap") to guarantee that where object lifetime can be determined statically it is. The problem is also not eclipse, it used only 75-80M of the heap at any time, but the heap was huge and constantly being swapped out. GC has another problem in that lifetime determination can't be used to free resources in anywhere near as neat a way as can be done in non-GC code. But I wouldn't be averse to GC versions of each type where requested by the dev (with the compiler generating wrappers as necessary and avoiding GC where it can determine the lifetime).

      Programming in C++ is much more practical when you use funtional programming with function composition, type polymorphism, and its partial support for dependent types instead of OO and object polymorphism.

      Or if that's your preference, you could just use a language designed to support those things, and doing so much better, from the start.

      I often do, but beggers can't be choosers, sometimes - tools are all part of the equation and a language with poor tools is a poor language. Many of the new C++ features are designed to bring C++ closer to languages like ocaml and haskell with a modicum of type deduction (new auto uses) and concepts (Haskell counterpart -> type classes).

      Don'

    9. Re:Replacing C++? by Anonymous Coward · · Score: 0

      Perl's standard library (the stuff that's part of the default install) is increasing as new releases come, so perhaps one day most of the bases will be covered?
      There are also several big-time modules like LWP and Tk that almost everyone reaches for first. But Perl's TIMTOWTDI philosophy precludes for strong standards, at least not as strong as Java's. If I want to do some networking stuff, should I use POE or Net::Server? For templating, do I got with Template Toolkit or one of the many others? It depends on my needs, my familiarity with then, and also my personal coding style!

  29. Re:C Plus Plus Bye Bye by marcosdumay · · Score: 1

    "Is Common Lisp really an industrial strength development tool?"

    What is an "industrial strength development tool"?

    Lisp has advantages and disadvantages, like anything else. Prejudice will lead you nowere.

  30. Re:C Plus Plus Bye Bye by Goaway · · Score: 1

    What is an "industrial strength development tool"?

    A programming language which you can use to develop, debug and distribute a real-world, functioning application in, I'm guessing. Something like, say, Firefox. Use native APIs, native GUIs, run at decent speed, behave like a native app.

  31. Pointer arithmetics is key by marcosdumay · · Score: 1

    Nothing without pointer arithmetics will ever replace C/C++. D is a candidate, but unlikely. Eiffel is out.

  32. Re:C Plus Plus Bye Bye by everphilski · · Score: 2, Interesting

    C++ has gone the way of Fortran

    Sadly, I generate new Fortran code on a regular basis. I wish I was generating new C++ ...

  33. Re:Answer : Common Lisp by Anonymous Coward · · Score: 0

    Amen.

  34. Re:Visual Studio by gr8_phk · · Score: 1
    Can you build applications and recompile for Linux, MacOS, or Playstation with that?

    I didn't think so.

    Been there, had to deal with that. No more.

  35. It is?! by Anonymous+Brave+Guy · · Score: 2, Informative

    How do you figure that? I work in low-level code, where performance really matters, and I still can't remember the last time I used pointer arithmetic. Sure, I use array indexing all the time, but the fact that this is semantically equivalent to pointer arithmetic in C++ is coincidental. As long as a language supports arrays (as in contiguous memory that supports fast random access — contrast with linked lists) and indirection (call it a pointer, a reference, a link, whatever you like — something you can build graph-like data structures with) then I don't see any need for pointer arithmetic at all.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    1. Re:It is?! by cerelib · · Score: 2, Insightful

      You are right in a way. Most people do not need pointer arithmetic, but it becomes very useful when you are working with external blocks of data. For example, I was writing some audio capture code in Java and with it you are passed byte arrays. In Java, you cannot simply treat this as a block of data because it is an object. It makes doing things like 16+ bit audio quite annoying. With pointer semantics I can simply treat the byte array like a short array and be done with it. There are many applications that deal with such external blocks of data that also need high performance, which requires the use of memory pointers. To completely replace C/C++, a language must allow this kind of direct memory manipulation.

    2. Re:It is?! by 0xABADC0DA · · Score: 1

      With pointer semantics I can simply treat the byte array like a short array and be done with it. byte data[] = ...;
      ShortBuffer sb = ByteBuffer.wrap(data).asShortBuffer();
      short val = sb.get(index);

      So... you were saying?
    3. Re:It is?! by marcosdumay · · Score: 1

      "Sure, I use array indexing all the time, but the fact that this is semantically equivalent to pointer arithmetic in C++ is coincidental."

      Not quite a coincidence. That fact is what makes array indexing fast (and unsafe) at C/C++.

      Also, do you optimize the way you put variables at stack or hash? That is impossible with automatic memory management (altough Eiffel comes close, things are not as good there). Do you directly interface the hardware? That is so hard without pointers that one could consider it impossible too.

      Not to cite all those complex structures that we sometimes need to create at memory and would need to transform into hashmaps if not by pointer arithmetics. There is also low level optimizations where you buffer the memory management (your program being faster than the OS), shared memory IPC, and lots of other.

    4. Re:It is?! by Anonymous+Brave+Guy · · Score: 1

      I'm sorry, but I just don't understand your post. I frequently do pretty much everything you're talking about there. Pointers are useful, but as I said before, I can't remember the last time I wrote an expression using explicit pointer arithmetic. If you're doing manual memory buffer management for some reason then OK, but even fairly low-level code rarely needs to do that, and it's the sort of thing best wrapped up behind a safe API anyway.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    5. Re:It is?! by iluvcapra · · Score: 1

      How much memory did you allocate doing that, and how many cycles did you burn jumping just to use your member calls?

      If you were doing some non-realtime process, like converting an audio file, that'd probably work OK, but if you're rushing to get those samples to the DAC before its buffer underruns, it might work on some peoples computers and not on others, and it takes a hella lot longer to spin through a buffer and may or may not be copying the buffer into your scope -- with a language like java, it's impossible to tell, since they've abstracted away so much of the machine. It's not just audio; MIDI notes can get serious latency if you don't move them on time, particularly if your gear doesn't use MIDI Timestamping, and any process that generates big loads of realtime input data needs it too. In java's favor is the fact that most people don't generate big gobs of realtime data.

      It's sortof a corner-case; java and python and ruby are great for most things, but you need some of those C++ features if you're squeezing audio through a buss. You can use java to wire the low-level pieces together, but the trucking of the bytes still to be done on the registers of the physical machine.

      --
      Don't blame me, I voted for Baltar.
    6. Re:It is?! by 0xABADC0DA · · Score: 1

      Yeah right... most machines sound takes far less than 0.1% of the CPU time to 'push the bits'. Even if you write it in C++ or asm it "might work on some people's computers and not on other". Ooh scary.

      These methods get inlined directly by the JIT since it knows the final types so these buffers are generally equivalent to arrays in overhead. They do check bounds though, but if you want to crash your sound app go ahead and write it in C++.

      The OP was wrong about the Java API because he was not aware of java.nio.* existing. You are wrong about the performance impact. You are right about not using nondeterministic features for a realtime application (runtime of malloc/free aka new/delete is nondeterministic fyi). Of course you could pre-allocate your buffers and other objects in Java just like you can in C++.

    7. Re:It is?! by cerelib · · Score: 1

      Thanks for pointing that out. I had looked for something like this, but could not find it. I guess I should have tried posting to a forum. While it does handle the simple example that I gave, it does not seem to provide the general functionality needed in an easy way. What if you have a block of data that is more complex than simple integers? Even if you are handling stereo data, you would rather break it up on a frame boundary. Java just does not have direct memory manipulation that is needed for some high performance applications.

    8. Re:It is?! by iluvcapra · · Score: 1

      Yeah right... most machines sound takes far less than 0.1% of the CPU time to 'push the bits'. Even if you write it in C++ or asm it "might work on some people's computers and not on other". Ooh scary.

      Well it is, if you want the code to "write once, run everywhere" (by everywhere we mean NOT "all arbitrarily fast and memory capacious home computers" but "any computer, including embedded systems, from Micro-ITX Mobos to battery-powered greeting cards that speak a greeting when opened." And forgive me for being so handwavy, it's not "pushing the bits on the buss," it's more like "reading the bits off the disk driver at whatever rate it'd like to get them for you, passing these to ringbuffers, keeping track of the ringbuffers state so they don't underrun, synchronizing the threads that read the input ringbuffers so they're all pulling the precise sample for the given realtime offset, reading the samples from the ringbuffers for several streams into the CPU for summing, writing the summed stream to the summed ringbuffer (or "mix buss"), keeping a tally of how many samples you send to the DAC so you don't overrun it, and emitting the bytes to the DAC. You CAN do it all in java, but if their are performance problems on platform X, your boss will ask you "Is this code written in the fastest way possible?" and if there's anything in it pertaining to java, you know how you'll have to answer.

      These methods get inlined directly by the JIT since it knows the final types so these buffers are generally equivalent to arrays in overhead.

      Generally? In C or C++, you can make it compulsory.

      They do check bounds though, but if you want to crash your sound app go ahead and write it in C++.

      You mean like these guys?

      --
      Don't blame me, I voted for Baltar.
    9. Re:It is?! by Anonymous Coward · · Score: 0

      You mean like these guys? I don't know, are you trying to say they are written in C++? For all I know the core parts are written in LISP.

      it's more like "reading the bits off the disk driver at whatever rate it'd like to get them for you, passing these to ringbuffers, keeping track of the ringbuffers state so they don't underrun, synchronizing the threads that read the input ringbuffers so they're all pulling the precise sample for the given realtime offset, reading the samples from the ringbuffers for several streams into the CPU for summing, writing the summed stream to the summed ringbuffer (or "mix buss"), keeping a tally of how many samples you send to the DAC so you don't overrun it, and emitting the bytes to the DAC. Wow that sounds really impressive. Maybe C or C++ is needed after all for those 500 lines of the program.
      /sarcasm
    10. Re:It is?! by marcosdumay · · Score: 1

      Except deferencing/referencing, all explicit pointer arithmetics is too usafe to not be closed behing a safe API. That doesn't mean the language would be usefull without them, how would you create that library otherwise?

      Also, explicit deference/reference is pointer arithmetics, and leads to all those other pointer operations you see on C, after all, pointers are just integers. They must come toghether, and you can't do the things I cited without explicit deference/reference.

      And then comes hardware communication, where you often interpred structs as pointer arithmetics (they are semanticaly equivalent too), deal with on place copying, pass pointers around from the CPU to periferics and the other way around...

  36. You're kidding, right? by Anonymous Coward · · Score: 1, Informative

    This is why I hate to work in C++:

    1) Syntactic ambiguity: you can't tell from a glance whether your function call is sending a copy of an object or a reference to an object. A fault with C also, but this should've been fixed

    2) Templates: buggy and inefficient. I would've preferred STL to work on a generic object class.

    3) RTTI: Still not sure what this is getting you in C++. Dynamic casts? Unfortunately you have to choose to enable or disable it per-file, whereas having a base object class would let you do it per-object.

    4) Operator Overloading: another case of ambiguity. You'll never be quite sure what your code is doing.

    5) Lack of Garbage Collection: I would've at least liked a reference counting pointer without having to download BOOST.

    6) Non-standard ABI: C object files are reusable across multiple compilers, since their format is standardized. In C++ it's not. Everything must be compiled in the same version of the same compiler.

    That's just what I came up with on my own. I'm sure other people have more problems.

    1. Re:You're kidding, right? by the_greywolf · · Score: 1

      1) Syntactic ambiguity: you can't tell from a glance whether your function call is sending a copy of an object or a reference to an object. A fault with C also, but this should've been fixed

      template<class T1, class T2> T1* f1(T2);
      template<class T1, class T2> T1& f1(const T2&);

      The first takes a copy of an object of type T2 and returns a pointer to an object of type T1. The second takes a const reference to an object of type T2 and returns a reference to an object of type T1. What's so difficult about that?

      2) Templates: buggy and inefficient. I would've preferred STL to work on a generic object class.

      Templates are incredibly efficient, though difficult to write correctly the first time around. A template class has zero code presence if it's never referenced, and complex recursive templates can compile down to a single constant. It's turing-complete, and therefore capable of any operation. The most infamous use of templates was a template that returned successive prime numbers as error messages! Most bugs show up at compile time, and are thus easy to fix. (Error messages will get help in C++0x.)

      4) Operator Overloading: another case of ambiguity. You'll never be quite sure what your code is doing.

      This is why you need to ship strong documentation with your libraries. But when you're actually using operator overloading, it actually makes a lot of sense and simplifies otherwise verbose code. For example:

      template<class T> vector3 {
      vector3(T x, T y, T z) : _x(x), _y(y), _z(z) {}
      T _x, _y, _z;
      vector3<T> operator+ (vector3<t>& r) { return vector3<T>(_x+r._x, _y+r._y, _z+r._z); }
      }

      void f1() {
      vector3<float> vA(1.2, 2.3, 3.4);
      vector3<float> vB(2.3, 3.4, 4.5);
      vector3<float> vC;

      vC = vA + vB; // vC == (3.5, 5.7, 7.9)
      }

      Of course, there are the coders who do weird things with mislabeled functions, but who in their right mind would use that code anyway?

      5) Lack of Garbage Collection: I would've at least liked a reference counting pointer without having to download BOOST.

      It is being considered (AFAIK) for C++0x. But why would you want garbage collection that hurts your program's performance and takes up precious memory that could be better used by your program in 256KiB of memory on your embedded system? Or, for that matter, would you want it interrupting things in your massive 4GiB program just to clean up a huge heap that is under extremely heavy use? (Like in a database.)

      GC is not for everyone. It's be nice to have a little help, but it gets in the way.

      6) Non-standard ABI: C object files are reusable across multiple compilers, since their format is standardized. In C++ it's not. Everything must be compiled in the same version of the same compiler.

      This is only true when you're using virtual functions in your publicly exposed interfaces. GCC now supports the MSVC++ ABI (and can link with DirectX!), so it's clearly not an unsurmountable problem. I really don't see why this is a valid complaint now. (It certainly was a problem, but no more.)

      --
      grey wolf
      LET FORTRAN DIE!
  37. Is that right? by Gazzonyx · · Score: 1

    I thought that at linking time, only the parts of the library that are used are mapped to a symbol table. Or is it that it only links whole libraries if they're used, all or nothing? I haven't taken compiler design in college yet, but after SPARC assembly, well... I'm scared I'll lose whatever innocence I have left.

    --

    If I mod you up, it doesn't necessarily mean I agree with what you've said, sorry.

    1. Re:Is that right? by edwdig · · Score: 1

      The linker will remove functions it is positive won't be used. The issue here is calling cout to print "Hello World". You only *need* the code to print out a string, but once you get into the core of cout, you reach stuff like if (data is string) {} else if (data is int) else if (data is float) {}. Which branches are needed can't be determined until run time, so you have to pull in all the code to format ints, floats, etc. That's where the bloat comes from.

      It also means that the program won't grow much if you try doing fancy things with cout.

    2. Re:Is that right? by EsbenMoseHansen · · Score: 1

      The linker will remove functions it is positive won't be used. The issue here is calling cout to print "Hello World". You only *need* the code to print out a string, but once you get into the core of cout, you reach stuff like if (data is string) {} else if (data is int) else if (data is float) {}. Which branches are needed can't be determined until run time, so you have to pull in all the code to format ints, floats, etc. That's where the bloat comes from.

      It also means that the program won't grow much if you try doing fancy things with cout.

      Actually, cout << 5 and cout << "cheese" are two different function calls, that probably ends up in some putc() or whatever call. The signatures would be something like basic_ostring<...>::operator<<(const char*);

      --
      Religion is regarded by the common people as true, by the wise as false, and by rulers as useful.
    3. Re:Is that right? by edwdig · · Score: 1

      Actually, cout ::operator

      From what I've seen of g++'s headers, the different variants of operator seem to put the parameters into a common format and pass it into a core function that does the real work.

  38. Re:C Plus Plus Bye Bye by quickbasicguru · · Score: 1

    One program that was created using Common Lisp is Maxima.

  39. Tried to post a reply, it failed by theendlessnow · · Score: 4, Funny

    I tried to post a comment on this story, but was unable to upload my video response.
    (sigh)

  40. Flapping bird? by dazedNconfuzed · · Score: 1

    Site has been /.ed; in the video, does he alleviate viewer boredom by occasionally pulling a string to make a model bird flap its wings?

    --
    Can we get a "-1 Wrong" moderation option?
  41. Haskell is still a long ways from being useful. by Anonymous Coward · · Score: 0

    First of all, half-assed interactive modes like ghci and hugs are not good enough, there needs to be a real repl like lisp, scheme, ocaml, etc. Second, GHC is insanely slow, it takes ages to compile even simple haskell code, and its a serious hinderance to productivity. Third, dynamic loading needs to be supported in the standard library, not a 3rd party library that is unmaintained and no longer compiles. Fourth, its arguable wether or not laziness is a virtue. There's plenty of times where eager evaluation is helpful, and the times that laziness is helpful are comparatively rare. Explicity laziness like scheme and ocaml offer is likely a better way to go. And of course, a much better GC, which is multithreaded so the entire program doesn't need to be paused to run a gc.

  42. Re:C Plus Plus Bye Bye by Anonymous Coward · · Score: 0

    Good luck doing business applications that need rules based on dynamic delegates and such with LISP.

  43. design by committee, and can't say "NO" by r00t · · Score: 1

    Got a pet feature you like? Fine, it gets added to the language. Never mind if it is redundant. Never mind if it causes the standard to be ambiguous or self-contradictory. Never mind if it is impossible to implement. Never mind if it will cause error messages to be misleading.

    There exist C programmers. C++ programmers do not exist, because nobody knows the whole language. Lots of people can handle a subset of C++. (which they THINK is big, but is not) Put two of these C++ subset programmers on the same project and you have a problem. At least one of them, often both, is writing code that the other doesn't really fully understand.

    1. Re:design by committee, and can't say "NO" by ardor · · Score: 1

      Actually, the C++ committee is quite conservative about new features in the language. They prefer new features by libraries. Thats why D has delegates in the language, and C++0x has std::function in the standard library, for example.

      --
      This sig does not contain any SCO code.
  44. BTW, anybody using digraphs? by r00t · · Score: 1

    You'd think we'd have learned from the disaster of trigraphs, but no!

    Can anybody point to a real project (not an obfuscated C++ contest or C++ compiler test) that uses digraphs?

    This truly is a dumb-ass make-work "feature" for everyone. Don't we all just love how we sometimes need to add a random ugly little space to our source code to keep the compiler from fucking up?

    1. Re:BTW, anybody using digraphs? by Cassini2 · · Score: 1

      Digraphs would have come in really handy about 30 years ago when I was working with equipment that lacked a full keyboard and lower case letter support. After the invention of the IBM PC, lower case letter support became standard. Some CNC machines (notably Fanuc lathes and mills) still choke on lower case letters, but they only run G-Code programs and are not used for writing C software.

      Platforms that both lack full keyboard support, and run C compilers are few and far between currently.

  45. Static iostream size? by tepples · · Score: 1

    I'm reading through "Effective C++" by Scott Meyers So am I, but it'll be a few days before I've finished the first pass through the 85 items of the first two volumes. Then I'll need to read through it again to make sure I understand everything. Then I'll need to repeat the process with Effective STL.

    Streams - awsome. Do you code C++ only for PC-class or bigger machines? Or do you also code C++ for an embedded system with small (e.g. 256 KiB) RAM? If so, have you figured out how to compile a program (even Hello World) and statically link it against a Free implementation of the C++ standard library so that the executable is smaller than 200 KiB? I tried GNU libstdc++ with MinGW and (more to the point) devkitARM, and in each case, I got a binary roughly 250 KiB in size.
    1. Re:Static iostream size? by Cassini2 · · Score: 2, Interesting

      Do you code C++ only for PC-class or bigger machines? Or do you also code C++ for an embedded system with small (e.g. 256 KiB) RAM? If so, have you figured out how to compile a program (even Hello World) and statically link it against a Free implementation of the C++ standard library so that the executable is smaller than 200 KiB? I tried GNU libstdc++ with MinGW and (more to the point) devkitARM, and in each case, I got a binary roughly 250 KiB in size.

      I have compiled C++ code down for a PIC microcontroller with 8 kB of RAM. The trick is to use only stuff from the C99 standard. Then you compile the code using VC++ on a Microsoft PC and do your unit testing. You can then rename all the CPP files to C files, and recompile under the PIC compiler and generate valid code.

      In practice, the VC++ compiler is fairly non-standard, and the renaming of files business sucks. My solution was to move all the code into header files (.h), and then include the headers from stub .CPP and .C files.

      The interesting thing was, the development time on the project where I did this was drastically reduced. A full fledged C++ compiler, like Microsoft C++, made program test much simpler. Development time was dramatically reduced because of a much simpler test cycle. This resulted in much more reliable code being given to the PIC, further simplifying the embedded development/test cycle. Debugging an embedded platform is much tougher than debugging on a PC, so any debugging that can be done on the PC is really big bonus.

      Another interesting point is that for an embedded platform, particularly the really small chips, you may be better off turning off the entire C Run-Time Library. You aren't going to use any functions from it anyways. Calls like printf() and iostream make little sense on devices lacking basic terminal I/O commands.

      Additionally, on devices without virtual memory, you want to avoid calls like new and malloc(). Make everything possible stack based, allocated only once at known program points, or allocated statically. Minimize the number of random allocations and deallocations. If you are trying to prove correctness for long uptimes, you need to prove that malloc() always succeeds. That is a very difficult thing to do given the potential complexities of external memory fragmentation and memory leaks. There is no Virtual Memory available to cover up inefficiencies in your code, in new, or in malloc(). Exceptions are also bad, because you have to prove that every single one of them is handled correctly and won't cause run-time issues. Besides, exceptions, new and malloc() are big sources of random uninitialized memory variables, and often result in slower code. All unexpected behavior on an embedded platform is bad.

      On an embedded platform, for long up-times, you must also consider the possibility of hardware memory corruption. As such, statically allocated variables (non-indexed) are nice. You can read directly from a fixed memory location, and effectively verify allowed values. It is also desirable to keep the program simple and straightforward. This makes it easier to prove correctness and simplifies unit testing.

      To any potential coders out there: this approach is completely non-standard, and I don't really recommend it unless you are working with embedded devices. My coding style on a PC platform differs significantly from my coding style on memory constricted embedded devices (like PICs). Also, on an embedded device, program length is usually small (for speed). As such, fast obtuse fragments of code are tolerable (if they are commented.) For a PC, programs are bigger, and obtuse code is not nice.

    2. Re:Static iostream size? by gnud · · Score: 1

      have you figured out how to compile a program (even Hello World) and statically link it against a Free implementation of the C++ standard library so that the executable is smaller than 200 KiB?

      That would be uClibc++. No locales, but most other parts of c++. According to the webpage the library is about 76kb in an optimised build.
    3. Re:Static iostream size? by tepples · · Score: 1

      That would be uClibc++. Very interesting. Today I tried to configure it for cross-compilation (host: MinGW gcc, target: arm-eabi-gcc). I ran into a few roadblocks; would you like to help me work on it over e-mail or chat?
  46. Embedded Haskell? by tepples · · Score: 1

    And it looks something like Haskell. Static typing, lazy evaluation, high-level parallelism, pure functionality, explicit imperative-ness. Heck, monads even sound like something from the future. Let me know when code compiled with a Free implementation of Haskell runs nearly as efficiently on cheap, small, battery-powered hardware as corresponding C or C++ code compiled with GCC. Or does your definition of "something from the future" also include hardware from the future?
    1. Re:Embedded Haskell? by ezdude · · Score: 1

      First, what part of "looks something like Haskell" did you not understand?

      Second, when those battery-powered devices have multiple cores in the future, yes, I think "something like Haskell" will be more efficient than C++.

      Third - why do you capitalize "Free"? There are only free implementations of Haskell - as opposed to C++. Last I looked, the most efficient compilers for C++ - Borland, Microsoft - cost hundreds, if not thousands of dollars.

    2. Re:Embedded Haskell? by Anonymous Coward · · Score: 0

      Not to mention GHC produces C code that you're free to tweak if needed just fine? And that if you're coding for something embedded, you're far less likely to introduce bugs in a functional style (some classes of bugs are simply impossible, namely all those involving state).

    3. Re:Embedded Haskell? by nuzak · · Score: 1

      > Not to mention GHC produces C code that you're free to tweak if needed just fine?

      It's my understanding that ghc doesn't normally produce C output, but that it's a backend you can select. You really don't want to touch the C output of ghc though. It's not made for human consumption.

      --
      Done with slashdot, done with nerds, getting a life.
  47. NOR flash vs. NAND flash by tepples · · Score: 1

    Most embedded systems use flash RAM for storage, so you just arrange to have the OS run the code directly from there There is a big difference between NOR flash and NAND flash. You cannot execute directly from NAND flash. You can execute from NOR flash, but the 512 KiB NOR flash on the system I work with is only large enough to hold a boot loader, a file picker, and a few built-in apps that most users do not want to uninstall just to run one application. Therefore, user applications must load entirely into DRAM. The rest is 1 GB of NAND flash, which does not support execution in place.
    1. Re:NOR flash vs. NAND flash by swillden · · Score: 1

      Thanks. I guess I just haven't developed for devices that use NAND flash. Assuming that transfer from NAND flash to DRAM is fast enough, I can think of a few ways to structure it so that you could get the effect of executing from flash (basically using a small DRAM buffer to hold the currently-executing block of code, and arranging to "page-fault" the next block in as needed -- it can even be done without an MMU, though an MMU makes it easier). If the NAND->DRAM transfer isn't fast, though, apps whose working code set doesn't fit in the DRAM "execution cache" would take a serious performance hit.

      --
      Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
    2. Re:NOR flash vs. NAND flash by tepples · · Score: 1

      Assuming that transfer from NAND flash to DRAM is fast enough It may not always be fast enough. NAND flash is the same kind of flash memory in USB memory sticks or in SD cards. In the specific environment we're discussing, it's a CompactFlash card, and a 16 KiB read might take 30 milliseconds. There is a classic video game emulator for this platform that supports large games through virtual memory, and some games that are significantly larger than RAM exhibit noticeable slowdown.

      I can think of a few ways to structure it so that you could get the effect of executing from flash (basically using a small DRAM buffer to hold the currently-executing block of code, and arranging to "page-fault" the next block in as needed -- it can even be done without an MMU, though an MMU makes it easier). This platform has an ARM7 CPU with no MMU. Is the method without an MMU called overlays?
    3. Re:NOR flash vs. NAND flash by swillden · · Score: 1

      This platform has an ARM7 CPU with no MMU. Is the method without an MMU called overlays?

      Actually, the one I was thinking of would probably be pretty inefficient, even with sufficiently fast I/O, and it would completely break in the case of apps that dynamically generate bits of code -- like the "trampolines" that GCC generates in some cases. Overlays work (remember VROOOM from the DOS days?), but are painful and limited.

      No, it seems like in your case you need the code to be small enough to fit in RAM, no getting around it.

      A little experimentation showed me some interesting things, though. On my system (Debian Sid, gcc 4.1.2), a statically-linked, hello-world app is exactly the same size in both C and C++ (491KB, statically-linked, stripped, exceptions disabled for C++). If I add a little "class" to both, the C++ app actually ends up being a bit smaller than the C app, thanks to some inlining done by g++ but not by gcc. Hmmm... if I mark the functions as static, then gcc inlines them too and we're back to identical sizes.

      What that means, of course, is that what's making my programs big isn't the C++ lib, it's the C lib. I assume you're using uclibc or something similar.

      Of course, I'm not actually using any C++ library features in this test app. Using iostreams rather than printf to output "Hello World\n" adds 273K. But that's easy to address -- just don't use iostreams. Also, if I add a virtual function to the C++ class, the size jumps up by about 30 KB, for all of the infrastructure needed to support virtual functions. But adding more virtual functions, or even more classes with virtual functions, doesn't increase the size appreciably, so that's a one-time cost (and well worth it, IMO). Making use of new/delete style memory management also pulls in the virtual function support and the 30 KB (which then makes adding virtual functions to my class "free").

      Continuing the experiment, I added some simple STL use to see how it would "bloat" the code. Using a std::vector added 1.5 KB to the C++ app size. Adding a second vector increased code size by 200 bytes, indicating that the vast majority of the increase is a one-time cost. Adding a C-style array to the C program, plus code to initialize and clean it up, added about 100 bytes. Given the difference in safety and ease of use, though, I'd probably pay a couple of KB for the std::vector, especially since for another 50 bytes of code size, I can switch to a std::set and get a highly-optimized red-black tree rather than a vector. Obviously, I didn't try to implement that in C.

      All in all, the code size differences I see on my system are trivial. A C++ app that uses std::string, std::vector and std::set, as well as virtual functions and iterators is 40KB larger than an almost-comparable C app (no set implementation), and I'd expect the difference to become even smaller as the application grows, especially since 30KB of it is the fixed cost of having the basic infrastructure for virtual functions. Unless you're really counting every byte, I think you're better off with C++ rather than C. And if you're really counting every byte, you probably better look at assembler.

      BTW, I'm building with "-static -Os -Wl,-gc-sections" for both C and C++. For C++ I'm adding "-fno-exceptions". The "-Wl,-gc-sections" tells the linker to avoid linking in any unused functions. It helps quite a bit, removing about 30KB from both C and C++.

      --
      Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
  48. Absolutely correct by Anonymous Coward · · Score: 1, Interesting

    There's no way to implement clean callback interfaces in C++ without tons of noisy syntax. Delegates are such a natural idea and would be such a nice fit for C++ (static type checking, fixed value size). The method pointers have absolutely no use and have weird semantics.

    Delegates deal with 90% of all practical uses of closures, but I guess acknowledging that would be too much for some people's pride.

  49. give it a rest by m2943 · · Score: 3, Insightful

    C++ is my main development language right now, but I have to say: please give it a rest. C++ is what it is, and I don't think adding even more crap to it is going to make it any better.

    What we need is a language with C++-like performance characteristics and a C-like syntax that will feel familiar to C/C++ programmers but without all the baggage of 30+ years of C history.

    (And, no, neither Java nor C# are that language.)

    1. Re:give it a rest by orclevegam · · Score: 1

      What we need is a language with C++-like performance characteristics and a C-like syntax that will feel familiar to C/C++ programmers but without all the baggage of 30+ years of C history.

      (And, no, neither Java nor C# are that language.)

      Someone already linked it in a previous comment, but take a look at D. Personally I think it's C++ done right, although right now it's still in the growing stages. With a bit more support it could grow to become a real contender.

      --
      Curiosity was framed, Ignorance killed the cat.
    2. Re:give it a rest by jmpeax · · Score: 1

      Object Pascal? Lean, efficient and syntactically not a world away from C++.

    3. Re:give it a rest by m2943 · · Score: 1

      I did look at D. I think it's better than C++, but I think it's still way too complex for what it does.

      Overall, actually, I think a batch-compiled (non-VM) version of C# 2.0 would be a fairly good language.

    4. Re:give it a rest by Anonymous Coward · · Score: 0

      There's always Delphi. It has good performance of course, a great IDE, and it's surprisingly C-like in syntax - more akin to C# (after all, one of the people behind Delphi is also behind C#.) It uses keywords more than symbols more often than C, but it's far more similar than, say, Python or other languages that stem from different roots. Methods, including closures, as a base language construct; metainfo and type info (in a natively compiled language!) are too; it has a great UI editor and doesn't separate UI and code - ie no "IDE only" sections of code. It's one of those few languages programmers never go back from once they know it.

      It's used a lot in-house and overseas, but doesn't get much press, which is a pity. It probably has a lot to do with how many users aren't in the US, combined with the lack of funding and support it got from Borland up until a year or so ago. Thankfully for all its fans it belongs to its own company now.

      FWIW, there's an open-source compiler as well.

  50. Stroustrup by Anonymous Coward · · Score: 2, Funny

    always wondered who the strstr function was named after...

  51. What follows C++ is probably by Anonymous Coward · · Score: 4, Interesting

    a new language like D and not just an improved C++.

    As a C++ programmer, I can tell you that it is nearly impossible for C++ to make coding, compiling and debugging easier without redesigning the language.

    Coding: Name one C++ editor or IDE that offers accurate code completion or code refactoring (compared to other languages.) I've tried Source Insight, SlickEdit 2007, Visual Studio 2005, Understand for C++, Vim, etc. and it is clear C++ is too complex compared to most other mainstream programming languages.

    Compiling: Implementing a C++ compiler is far too difficult. And compiling takes too long even when you use C++ idioms like pimpl.

    Debugging: Sure, boost.org's smartpointers and RAII are helpful but how many hours do C++ programmers spend tracking down bugs that would've taken minutes (if not seconds) to track down or avoid in other programming languages?

    Why do I use C++? Because it is compiled, has numerous 3rd-party libraries, and is widely used. Like Windows XP, it might be a pain but it is so widely used that you'll have no problems finding employers that will pay you to use it.

    Simply put, we deserve something better than C++ and it isn't going to be enough to enhance C++ because a full redesign is needed in order to address the issues noted above. We need and deserve a language that takes what we've learned from C++ and is designed from the ground up to address those issues.

    So far, D programming language seems to offer the best hope, and some really talented C++ gurus like Walter Bright and Andrei Alexandrescu are involved.

    1. Re:What follows C++ is probably by Anonymous Coward · · Score: 0

      Hello Walter, is that you? Some Anonymous Coward has been pimping D all over this discussion. It has to be you.

    2. Re:What follows C++ is probably by ChrisA90278 · · Score: 1

      "Simply put, we deserve something better than C++ and it isn't going to be enough to enhance C++ because a full redesign is needed in order to address the issues noted above. We need and deserve a language that takes what we've learned from C++ and is designed from the ground up to address those issues."

      Yes, I agree. It's odd that Ada did not see wide usage outside of it's specialty. It is used today mostly only for applications that a "life critical" meaning that people could die if the code breaks. Things like the flight controls on airplains, controls on nuclear reactors and guidance systems on cruise missiles.

      If you were going to be the test pilot AND the programmer for a new fly-by-wire flight control system. What language would you pick? There is a good change a software bug would be fatal (literally) so choose the language well. Very few would pick C++.

      Ada was designed from the ground up to cover all the Issues. It does it well. The problem was with programers and their managment who looked at it said "I don't want to have to learn something new". The other big proble was that it was some years later thatthere iwas a good, free compiler. I think the not-free compiler is what did it in. But now days gcc does Ada and the generated code is as good as you get from C++

    3. Re:What follows C++ is probably by hackingbear · · Score: 1

      Agree... but what D needs is a better name nowaday. otherwise, it will not succeed as a mainstream language.

    4. Re:What follows C++ is probably by Nynaeve · · Score: 1

      If you were going to be the test pilot AND the programmer for a new fly-by-wire flight control system. What language would you pick? There is a good change a software bug would be fatal (literally) so choose the language well. Very few would pick C++.

      As a matter of fact, Lockheed Martin used C++ with the Joint Strike Fighter.

    5. Re:What follows C++ is probably by mqduck · · Score: 1

      Agree... but what D needs is a better name nowaday. otherwise, it will not succeed as a mainstream language. Turbo Visual D++ .Net?
      --
      Property is theft.
    6. Re:What follows C++ is probably by scotch · · Score: 1

      No, I'm sure Walter is too busy in the comp.lang.c++* newsgroups pimping D to spend time slumming here. Really, how many people that read this site are serious professional C++ (or even C) developers who might be part of the D potential market? 5%? 3%? comp.lang.c++ is full of fish in a barrel for Mr. Bright.

      --
      XML causes global warming.
    7. Re:What follows C++ is probably by ChrisA90278 · · Score: 2, Interesting

      I was carful when I wrote "flight control software" and not just "flight software". Seems they are going with Ada for the approx 4% of the code that really matters. The JSF will have about 15 million lines of code aboard. So only 150,000 lines is considered "safely critical" I guess. That's good because I doubt anyone could write 15M bug free lines of code. 150K will still be "way hard" but do-able. I read Lockeed's presentation where they jutified C++. Their reasoning was simple: They would not hire enough Ada programmers. They said they could not train them either because people don't see a career in Ada anymore so they leave. The bulk of the pages was numbers to support the claim that there are not enough people to write 15M lLOC in Ada and worse, in futrue years there will be no one to maintain it. Notice that they are not really writing in C++. They are writing in a very restricted sub-set of C++ and the subset is defined in a way to facilitate testing and inspection.

    8. Re:What follows C++ is probably by sashang · · Score: 2, Interesting

      Check out OCaml. It has C++ like features without the headache. It's more advanced than D and has great performance characteristics. It supports type inference (so you don't need to remember the type of the variable), static typing, generic programming (templates in c++) via modules and functors, concepts (which are meant to be part of c++0x) via signatures, virtual functions via subtyping, and garbage collection. It's also a functional language so you get the core features of functional languages, like pattern matching.

    9. Re:What follows C++ is probably by Anonymous+Brave+Guy · · Score: 1

      Actually, Walter does post here (or at least someone sounding like him and using his name does) from time to time. I find his constant advertising and often unsupported claims rather boring, but he does at least have the decency to put his name to them, so I'd be surprised if he also posted AC junk. Perhaps he's slowly accumulating a group of evangelists who bought the hype? <shudder> :-)

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    10. Re:What follows C++ is probably by Raenex · · Score: 1

      Perhaps he's slowly accumulating a group of evangelists who bought the hype? I follow the D newsgroup. I don't use the language myself, but I'm intrigued by it and like to watch its development. To answer your question, yes, D has quite a lot of strong community support. If there is any competition at all for a C++ successor that isn't C++0x, D is it.
  52. Strostrup is now part of the problem. by Anonymous Coward · · Score: 5, Interesting

    C++ has many problems. Some, like "an array is a pointer", it inherited from C. Some were mistakes in the original design that were later fixed, like unchecked downcasts, "this" as a pointer rather than a reference, and the lack of generics. And some are there because Strostrup is in denial about the problems, like the fact that the language gives no help with either thread or memory management.

    Memory management remains the biggest problem. The fundamental problem is that C and C++ require the programmer to obsess on who owns what, while providing zero assistance in managing that information.There are ways out of this, involving syntax and compiler support for owning and non-owning pointers. But instead, attempts have been made to paper over the problem with templates. This never quite works, because for some things you still need a raw pointer, which breaks the abstraction. The history of auto_ptr (up to standard revision #4 now, I think) makes this clear.

    Bolting on a garbage collector doesn't help much in a language with destructors; see the mess in Microsoft's "managed C++". If you're going to go with a garbage collected approach, it's better to go to a language designed for it, like Java.

    Most of the standards effort is going into template features that few will use and fewer still will use well. Trying to use the template expansion engine as a general purpose macro system is a terrible idea for production code. But it has a big fan club on the standards committee. Worse, the C++ commitee does very little to improve language safety and reliability. Which is why we still have buffer overflows in C++ code, fifteen years in.

    Incidentally, none of this has anything to do with C++ being compiled directly to machine code. There have been safer compilable languages usable for system-level programming. Modula 3 was probably as good as it got. But that language died when DEC went under. It's possible to hard-compile Java; there's a version of GCC for that, and it's getting some interest in the embedded community. The problem could be fixed. But it won't be, because the people responsible are in denial.

    1. Re:Strostrup is now part of the problem. by macrom · · Score: 2, Insightful

      I don't think Stroustrup is in denial at all. Read his book The Design and Evolution of C++ for insight into his decision making process. You may not always agree with it, but at least he's thought things through. When developers start launching complaints about missing features from C++, they generally miss the point of why C++ exists in the first place. It's not a be-all-things-to-all-programmers language. It's a tool to help you get many different types of jobs done.

      No thread management : this is an OS-specific issue. Yes, almost all modern operating systems use threads, but C++ isn't designed to do OS tasks. It's a tool so that you can design your own management of threads in a way that suits your projects and style. Use Boost if you want a widely-supported, cross-platform set of thread management classes.

      No memory management : again, OS-specific. What if I don't want garbage collection? I like the fact that C++ has deterministic destruction of objects, and I can use that to my advantage. If you want memory management, use boost::shared_ptr and it's siblings. Yes, auto_ptr is broken for various activities, but if you aren't aware of the freely available and widely supported alternatives that work just fine, then you need to update your C++ skill set. Stating that templates are a bolt-on solution for memory management is way off base and shows that you don't really understand that templates are a generic programming construct. And to state that we have buffer overruns in C++ because of bad language features is, again, attempting to assign the problem to the wrong source. If developers would use smart pointers and other safe development tactics, a lot of the problems would go away. Hell, I work with a guy now that refuses to use 'const' in parameters because it involves typing 6 extra characters. It's attitudes like this that cause runtime issues, not the choice of language.

      C++ is still a great language. If programmers would take time to familiarize themselves with quick and easy ways to start tightening up their code, we wouldn't have so much problematic software. Instead, everyone sits around and looks at Java, C# and their ilk and demand that the same do-everything-for-me features be brought over. That's not the spirit of C++, and frankly I don't want to see C++ messed with that way. When I want those features, I use those tools and understand why both exist.

    2. Re:Strostrup is now part of the problem. by Cassini2 · · Score: 2, Insightful

      IMHO, I think:
      a) If you want garbage collection, you have to leave C++ and go to a truly safe language like Java or one of the .NET languages. You can't have the ability to do whatever you want to a variable, and the ability to be safe from it simultaneously.
      b) If you are trying to code a GUI application with cool RAD development tools (like VisualBasic and Eclipse), then C++ is the wrong language. It was never built to be quick and easy for the programmer. Additionally, the windows based object-oriented metaphor makes proper memory management difficult.
      c) If you try to use all of C++ in one program, you deserve to be shot. C++ should be used with strict coding guidelines on what features will be used, and what features won't be used. These features can be picked on a per application basis, and thus the language can be customized for almost anything. Just don't try to do everything simultaneously.

      What C++ excels at are projects that require complete control of the machine. If you need the asm directive, its there. If you need funky type unions, you have them. If you need to organize your code, so people can understand it, you have objects and namespaces. If you need to customize the behavior of new(), you can do it. If you need C language compatibility with your header files, it can be done. C++ gives you every option that you may need. Just don't use all of them simultaneously.

    3. Re:Strostrup is now part of the problem. by ardor · · Score: 2, Insightful

      Most of the standards effort is going into template features that few will use and fewer still will use well. Trying to use the template expansion engine as a general purpose macro system is a terrible idea for production code. But it has a big fan club on the standards committee. Worse, the C++ commitee does very little to improve language safety and reliability. Which is why we still have buffer overflows in C++ code, fifteen years in.

      Obviously, you never used modern C++ extensively.

      Templates are not a macro system, they are a typesafe meta-language. I agree that their syntax sucks, but they are lightyears away from being a simple macro system. And lots of people use them, just look at the STL string or vector. You think few people will use concepts or variadic templates, think again. Generic programming is the actual edge of C++.

      I really suggest you read "Modern C++ Design". There you can see perfectly valid examples of how to use templates. Policy-based is a good and powerful example. With this, I can customize my code at compile-time, for example, having a policy which locks a mutex in proper code sections, and another policy with no locks at all. This way, my code *can* be threadsafe, but does not *have* to be (thread safety is useless in a singlethreaded program). Oh yes, I could do that with the preprocessor too, but try debugging this. Also, say goodbye to namespaces, type safety and debugging support.

      Safety and reliability have nothing to do with C++ itself. Many people overuse new and delete, without relying on proper RAII constructs, for example. If you think MFC-style C++ is the zenith, you don't know C++. I have been programming C++ for over 7 years and reached a point where memleaks happen extremely rarely (mostly due to rushed code). Its no black arts, no voodoo, just proper C++ usage.

      --
      This sig does not contain any SCO code.
    4. Re:Strostrup is now part of the problem. by Anonymous Coward · · Score: 0

      "goodbye to debugging support"? Do you mean that there is a debugger somewhere that has useful support for template code? Which one?

    5. Re:Strostrup is now part of the problem. by ardor · · Score: 1

      With templates, you can get at the very least information about the typename, and the debugger shows where *in the template* the crash happened. You cannot get that from preprocessor macros. You cannot even set breakpoints in a macro.

      --
      This sig does not contain any SCO code.
    6. Re:Strostrup is now part of the problem. by Vexorian · · Score: 1

      C++ has many problems. Some, like "an array is a pointer"
      dude, fuck off. It is so retarded to see this post getting +5, I think I 'll seriously leave this site.
      --

      Copyright infringement is "piracy" in the same way DRM is "consumer rape"
  53. huh? by Anonymous Coward · · Score: 0

    OpenJDK, being yet another fork of Java, really doesn't address his concerns about the fact that Java itself is a platform and is still controlled by a single corporation.

    1. Re:huh? by owlstead · · Score: 1

      Except that it isn't. Sure, Sun has still a lot of control, but most decisions are made through the Java community process (JCP). IBM, one of the main competitors to Sun, is represented in quite quite a few JCP projects. If Sun would die, IBM would likely start to host the JCP projects; they've got way to much riding on the Java language to let its infrastructure die off.

  54. Re:C Plus Plus Bye Bye by NoOneInParticular · · Score: 1

    So by that definition, Java is not an industrial strength development tool. The entirety of the financial world disagrees here.

  55. For those who don't know the reference by Anonymous Coward · · Score: 0

    I'm still pretty much in awe of Mel
    http://www.pbm.com/~lindahl/mel.html
  56. I concede by tepples · · Score: 1

    Not to mention GHC produces C code that you're free to tweak if needed just fine? You're right: some benchmarks are faster on Haskell.
  57. null keyword rant by wiredlogic · · Score: 2, Insightful

    Could it really have been that difficult to add a "null" keyword to C++? "bool" was cleanly added to C99. We could have had "null" too. I accept the argument that (void*)() isn't typesafe but then the language expects you to throw around a literal integer "0" that is imbued with magical properties. How is this a cleaner solution? This magic 0 violates the type safety principal that got us into this rathole to begin with since it can be assigned to non-integral types (pointers). It can also transform itself into another value since the null address isn't necessarily 0 on all platforms.

    --
    I am becoming gerund, destroyer of verbs.
    1. Re:null keyword rant by wiredlogic · · Score: 1
      Frelling slashcode. That was supposed to be:

      (void*)(<null address>)
      --
      I am becoming gerund, destroyer of verbs.
    2. Re:null keyword rant by Anonymous Coward · · Score: 0

      No, not difficult, and it's been done in the coming revision of the standard; nullptr is it.

  58. I'd mod the parent up if i had points... by Maxmin · · Score: 0, Offtopic

    funny.

    --
    O lord, bless this thy holy hand grenade, that with it thou mayest blow thine enemies to tiny bits, in thy mercy.
  59. Re:C Plus Plus Bye Bye by Abcd1234 · · Score: 1

    but, if we talk about managed languages, I'd go straight for Python or Common Lisp.

    Meh, I'll take Smalltalk, thanks. :)

  60. Sloppy Code by maz2331 · · Score: 1

    I guess the whole parent post here is that C++ isn't tolerant of sloppy coding practices, and allows programmers to seriously hose themselves up because of it.

    1. Re:Sloppy Code by Anonymous Coward · · Score: 0

      No.

      C++ has at the same time a much terser syntax and weak typing of almost everything (where the relative position and interrelation of tokens leads to completely different logical meanings) than other mainstream languages.

      It's very powerful, but I'd wager that no single module or even program ever needs even 20% of C++'s feature set at the same time.

    2. Re:Sloppy Code by Anonymous+Brave+Guy · · Score: 1

      Well, not really. The first of my four points related to protection against sloppy coding, but the others (which are, IMHO, the more important ones) have nothing to do with how good a coder you are.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  61. Maybe use D by maz2331 · · Score: 1

    I've been looking at D, and it seems to address a lot of these concerns while cutting the "complexity" of C++, and borrowing things like "foreach" from other new languages. It's looking interesting, but not quite there yet for me.

  62. Re:C Plus Plus Bye Bye by Zekasu · · Score: 1

    Java's only real strength is that native code (native to Java's VM) can be run anywhere, but anything where there's a the runtime environment to run it. The financial word must note how slow Java applications are, I hope. (In comparison to so many other languages.)

  63. Comment removed by account_deleted · · Score: 1

    Comment removed based on user account deletion

  64. A lot of... by Anonymous Coward · · Score: 0

    Read my lisp: it's a lot of smalltalk !

  65. Re:C Plus Plus Bye Bye by Just+Some+Guy · · Score: 1

    I've heard a few people saying this. Is Common Lisp really an industrial strength development tool?

    The guys who wrote "Jak & Daxter" thought so.

    --
    Dewey, what part of this looks like authorities should be involved?
  66. D programming language by WalterBright · · Score: 1

    What we need is a language with C++-like performance characteristics and a C-like syntax that will feel familiar to C/C++ programmers but without all the baggage of 30+ years of C history. And we've got it. The D programming language. It's specifically designed to be a reengineering of C++.
    1. Re:D programming language by Cassini2 · · Score: 1

      Is this a new D language?

      Wasn't there a D for Data language in the mid-1980's? Byte even did an article on it ... Can anyone enlighten me further?

    2. Re:D programming language by Raenex · · Score: 1

      Wikipedia has the answer you are looking for.

    3. Re:D programming language by Cassini2 · · Score: 1

      Thanks.

  67. Re:C Plus Plus Bye Bye by marcosdumay · · Score: 1

    Better yet. It seems C++ is the only "industrial strength development tool". The "behave like a native app" part assures that.

    Thank God he said nothing about time to market :)

  68. Rant by treak007 · · Score: 2, Interesting

    Virtual machines like the JVM are all the rage nowadays. Sure they are cross-platform and have some benefits, but they will never replace true natively built code. C++ is a powerful tool that I use daily, and I would said it was anything but dying.

    C++ has a lot of different features, which is why some find it confusing, but it is those many features which allow the language to be so flexible. Whereas a language, again picking on java, such as java forces the programmer to follow a very strict object-oriented form, C++ gives the programmer a choice as to how they want to write their code. I can write very object-oriented code, with features java doesn't support such as operator overloading and multiple inheritance, or I can write very functional-based code that resembles C. Also, C++ gives the programmer true control over what is going on inside their application. In java for example, objects are passed by reference and primitives are passed by value. In C++, I can specify which of the two I want for either type on a per argument basis. Another example is exceptions, which are known to be a rather slow feature in a language. In a language such as Java, again sorry java fans, exceptions are an integral part of the runtime interpreter. In C++, if I find that I don't wish to use exceptions, I can disable support for them and regain that performance boost that was lost at the hands of exception checking.

    Alright, alright..I am done ranting for now. All I guess I am trying to say is that yeah, maybe C++ is a bit more confusing to a beginner then interpreted languages and the like, but it is those features which can be confusing that allow a programmer to really control their code. The better the programmer understands what the code they are writing is doing, the better code they will write. That being said, long live bit flags, unsigned variable types, multiple inheritance, operator overloading and raw pointers!

    -Your Local /. C++ fanboy.

    --
    Klingon Software is not released, it escapes, inflicting terrible damage onto the enemy as it does
    1. Re:Rant by Shados · · Score: 1

      Of course, aside for multiple inheritance, virtually all of what you mentionned can be done in C# Operator overloading is in, you can pass primitives by reference, and if you want to play with pointer arithmetics and toy with the memory directly, its in, too.

      There will never ever be a language that can be perfect for all scenarios, but C# is pretty good at hitting the middle sweet spot. "By default you can't shoot yourself in the foot, but if you really, REALLY want to, just wrap it up in an unsafe{ } block and go to town".

    2. Re:Rant by treak007 · · Score: 1
      Interesting. I really haven't messed around with C#. Part of me really dislikes using a propriety language, but I have heard some good things.

      "By default you can't shoot yourself in the foot, Is it better to make an idiot-proof language or make better programmers? Personally, I think the whole idiot-proof language idea is a complete waste. It just promotes more illiteracy in computer science.
      --
      Klingon Software is not released, it escapes, inflicting terrible damage onto the enemy as it does
    3. Re:Rant by Shados · · Score: 1

      The catch is, you're not trying to make an idiot proof language. You're trying to make an error proof language. Why? Because even the best programmer in the universe, when stressed against a crazy deadline, will go faster and make more mistakes.

      The point of eliminating pointers isn't to make the language easier (though it is a side goal I suppose), it is to make it error proof. That is just one example. Most (by faaaaaaaaaaaar) software that are written aren't new server engines, data components, or operating systems. They are business management front ends. That doesn't require any of this stuff, and having it just forces developers (no matter how good!) to spend more effort on things that can be automated and handle 80% of the cases well enough. By doing so, you save time (read: money), and at the end of the day, 99% of software developers write software so someone, somewhere, can save money.

    4. Re:Rant by treak007 · · Score: 1

      I agree with what your saying, most applications are not performance dependent or require the amount of control of a lower-level language. But to imply that higher level languages are more error proof then lower level language (I assume this is what you mean, correct me if I am wrong) is not completely correct. Again, since this is what I have experience in, I am going to pick on Java to provide an example. While Java provides a level of abstraction over lower level memory work, this creates another issue with the developer. Since the developer is not always sure what is going on behind the scenes, it is very easy to write buggy code that looks correct and is hard to debug. One example of this, although not life-threatening to the application but still rather annoying, is the issue with calling System.gc() (The method call to manually run the garbage collector). One would think that when they tell the JVM to run the garbage collector, the garbage collector would run, however inside the JVM, the application is not able to force the garbage collector to run, only hint to it that it might want to run. Now I realize that in the overall scope of an application, this seems minuscule and this is also just a java problem.

      I guess the overall message I am trying to convey is that sometimes providing a level of abstraction hides too much from the programmer, thus allowing for just as many bugs, albeit different kinds of bugs.

      --
      Klingon Software is not released, it escapes, inflicting terrible damage onto the enemy as it does
    5. Re:Rant by Shados · · Score: 1

      I understand what you say, though I heavily disagree, as from my experience (and I've worked quite extensively in just about every environments you can imagine), it is definately not the case, but (especially if you're in a team that don't quite understand the higher level language...remember, stuff like Java and C# doesn't mean you can hire crap programmers, no matter how much the project managers think so!!!), it definately can happen, experience may vary, and thus, I can't really argue with you... different experience, different results...

      What I can say, though it is not quite relevent to the discussion, but I will anyway... the issue with calling the GC directly -is- an incredibly easy to find bug =P In my opinion, ANYTIME the GC is called directly, thats a bug right there, so finding it can even be automated!!! Tadah! (Seriously though, NEVER EVER EVER call the GC directly. If you THINK you have to, its because there's an architecture problem somewhere...).

      I know you were just trying to make a point, but I had to say it, sorry! :)

    6. Re:Rant by treak007 · · Score: 2, Interesting

      What I can say, though it is not quite relevent to the discussion, but I will anyway... the issue with calling the GC directly -is- an incredibly easy to find bug =P In my opinion, ANYTIME the GC is called directly, thats a bug right there, so finding it can even be automated!!! Tadah! (Seriously though, NEVER EVER EVER call the GC directly. If you THINK you have to, its because there's an architecture problem somewhere...). Interesting. When I code in Java, I try to take control of the program as much as possible, which usually results in me fighting with the JVM. I acknowledge that writing Java code is like writing for a separate os, which acts completely different then the host os and that to write effective Java code, it becomes necessary to familiarize oneself with the JVM and all its nuances.

      This discussion reminds me of a very interesting book that one of my professors lent to me which was a sort of puzzle book describing some small intricacies within the JVM that could lead to rather large bugs. Even with higher-level programming languages, I still believe it is necessary to have a strong understanding of the underlying implementation. So in other words...

      doesn't mean you can hire crap programmers, no matter how much the project managers think so! Exactly!!
      --
      Klingon Software is not released, it escapes, inflicting terrible damage onto the enemy as it does
  69. Java and C# are easily decompiled. by Futurepower(R) · · Score: 1

    It seems to me that it will be several years before Java is truly open, if ever.

    Second, why did Sun and Microsoft want to make a new language, particularly when they don't use those languages internally? My answer is that Java and C# can be easily decompiled, making it easier for Sun and Microsoft to copy other people's code.

  70. Re:Visual Studio by Arterion · · Score: 1

    Maybe with Mono?

    --
    "That which does not kill us makes us stranger." -Trevor Goodchild
  71. C compatibility by Anonymous Coward · · Score: 0

    I think the focus on compatibility with C is both a blessing and a curse for C++. If it hadn't been, it would probably never have taken off; and now, it's too late to "clean up" the language.

    On the other hand, there are plenty of programmers who knew C and became "C++ programmers" by memorizing that "malloc" is now spelled "new".

    (ooh: captcha was "template")

  72. Jokes in Cobol by billstewart · · Score: 2, Funny
    I've only seen two. One is that there was a company Ryan McFarland that made a COBOL compiler for Unix named "rmcobol" - everybody thought that sounded like a good idea.


    The other came out on Usenet in the 80s and went something like

    Hey Rocky, watch me pull a computer program out of my hat!
    Oh, Bullwinkle, that trick never works!
    100 PROCEDURE DIVISION .... [couple more lines like that]
    Guess I oughta get another hat!

    Some of my coworkers got it, but a couple of them didn't. The disturbing part was that they recognized the Cobol program, but were too young to recognize Rocky and Bullwinkle...
    --

    Bill Stewart
    New Fast-Compression-only CPR http://preview.tinyurl.com/dy575ks
    1. Re:Jokes in Cobol by Mr.+Underbridge · · Score: 1

      Some of my coworkers got it, but a couple of them didn't. The disturbing part was that they recognized the Cobol program, but were too young to recognize Rocky and Bullwinkle...

      Whoa....that would mean that some college was teaching COBOL as recently as 10 years ago, I'd surmise, which should get their program de-accredited. Unless your coworkers were aliens.

    2. Re:Jokes in Cobol by LilGuy · · Score: 1

      My previous roommate went through a whole year of COBOL in his computer science major just a couple years back...

      He works in sales now.

      --

      You're nothing; like me.
    3. Re:Jokes in Cobol by Danga · · Score: 1

      Whoa....that would mean that some college was teaching COBOL as recently as 10 years ago, I'd surmise, which should get their program de-accredited. Unless your coworkers were aliens.

      COBOL is still being used in some coursework at a few universities including Northern Illinois University. There are still A LOT of companies looking for people with COBOL programming skills and those companies recruit heavily at NIU. At NIU they have kind of an "intro" course to get you going in COBOL and then later on there is an external data structures class that focuses on COBOL programming and JCL using COBOL on a mainframe (OS 390). Proof of the classes can be found here:

      http://www.cs.niu.edu/courses/ugradcatalog.shtml#2 50
      http://www.cs.niu.edu/courses/ugradcatalog.shtml#4 65

      I think the CS department including mainframe programming is GREAT because it really exposed me to things that almost no other CS program would and I am happy for that since it gives me more options when looking for jobs. It was a great way to get some mainframe experience, learn about COBOL and JCL programming (among many other things), and it was also an interesting way to learn about external data structures. I assume you are joking but why should using and teaching COBOL (a language still WIDELY used in the industry) in a CS program be thought of as something that is horrible? Sure, it would be great if those companies could magically move on to a more modern language for some of their applications but that isn't going to happen for sometime so experienced COBOL programmers will still be needed for a while.

      I also did 3 years of CS at The Ohio State University before transferring to NIU and that program was excellent for preparing a student to pick up and easily use nearly any programming language by focusing on the fundamentals and not specific languages. The mixture of solid fundamental skills along with a whole lot of practice with a few modern languages (C/C++(even C++/RESOLVE yuck), Java, Perl, VB) as well as with some older langauges (COBOL,FORTRAN,x86 assembler,OS 390 assembler) has really turned me into an versatile and agile developer and I am extremely happy with the education I received. I am still at the same company that I started at right after graduating about 3 years ago and I am still extremely happy working here. Thankfully, I mainly use C/C++ and Perl and not COBOL at all but I still could go the COBOL route if I wanted to.

      In closing the actual language used in CS courses should not really matter, it is the fundamentals that count. It does not matter what langauge CS programs use in their courses as long as they are relevant to the subject matter. Having a little mixture of old and new languages can be very interesting to some people and I definitely found it interesting. Don't knock something until you have tried it.

      --
      Hey, there is only one Return and it's not of the King, it's of the Jedi.
    4. Re:Jokes in Cobol by Nazlfrag · · Score: 1

      My sympathies. Nobody should have to learn x86 assembler as their first machine code *shudder*, it has so much stupid arbitrary junk I'm getting a headache just thinking about it. Assembler is still quite relevant though especially in debugging, and all of those older languages are still alive in production systems. Just please, pretty please, I'm begging you for the sake of humanity let COBOL die the death it deserves. Forget you ever knew it. Just help spread the rumour it broke during Y2K and using it puts you at risk of cancer.

    5. Re:Jokes in Cobol by jwo7777777 · · Score: 1

      Agreed. If you are going to learn assembler, do it on a nice 16-bit Motorola chip with a nice big linear address space. Intel assembler makes me shudder at night and also makes baby Jesus cry.

  73. I plan to watch the entire video. by Futurepower(R) · · Score: 1

    Thanks for your comment. I torrented the entire video, but have watched only the beginning.

  74. John Backus's talk on future of FORTRAN by peter303 · · Score: 1

    I heard the [ recently deceased ] inventor of FORTRAN talk about the future of computer programming in the late 1980s. Kind of remineded me Bjorn's talk. You can only take a dead horse so far. Incidentally Backus was working on Functional Programming languages at that time, kind of APL for the those with long memories.

  75. Why "compiled"? by phliar · · Score: 1

    Other than code obfuscation (which is getting less and less important), if you're just writing code why do you care if your language is interpreted or compiled?

    If you have specific requirements like performance or packaging, state them as such.

    If you implement your problem in various languages, I think you'll find that "compiled vs interpreted" is not a very useful distinction. The performance of the resulting application will depend completely on the quality of the compiler/interpreter, and not on whether it's a compiler or interpreter.

    --
    Unlimited growth == Cancer.
  76. Thanks for the -Wl,-gc-sections by tepples · · Score: 1

    What that means, of course, is that what's making my programs big isn't the C++ lib, it's the C lib. I assume you're using uclibc or something similar. Actually devkitARM uses newlib, but yes, it's similar.

    I added some simple STL use to see how it would "bloat" the code. Using a std::vector added 1.5 KB to the C++ app size. Adding a second vector increased code size by 200 bytes, indicating that the vast majority of the increase is a one-time cost. Did that add 1.5 kB to the <iostream> version, or 1.5 kB to the <cstdio> version?

    Unless you're really counting every byte, I think you're better off with C++ rather than C. And if you're really counting every byte, you probably better look at assembler. In fact, I do sometimes look at the assembly language produced by my C code. Looking at a nm of the .elf file before stripping it, I see a bunch of locale support detritus linked in. (moneypunct? timepunct? floating point emulator?) I could probably lose some of this by switching to uClibc++.

    The "-Wl,-gc-sections" tells the linker to avoid linking in any unused functions. It helps quite a bit Thanks a bunch for this tip. On devkitARM, I get 180,032 bytes for -Os -Wl,-gc-sections, compared to 253,652 bytes for just -Os.
    1. Re:Thanks for the -Wl,-gc-sections by swillden · · Score: 1

      Did that add 1.5 kB to the <iostream> version, or 1.5 kB to the <cstdio> version?

      The stdio version. Iostreams is big. I really like C++ but that's one part of it that I've never really been a fan of. I prefer the compactness of printf format strings.

      In fact, I do sometimes look at the assembly language produced by my C code. Looking at a nm of the .elf file before stripping it, I see a bunch of locale support detritus linked in. (moneypunct? timepunct? floating point emulator?) I could probably lose some of this by switching to uClibc++.

      Yeah, that's one of the best things about uclibc(++). No locales, no wchars. Saves a lot of codespace, for stuff that an embedded developer almost never needs. It ought to be possible to lose the floating point emulator if you're not doing any FP work, though you might have to use a customized printf that doesn't include FP support.

      Thanks a bunch for this tip. On devkitARM, I get 180,032 bytes for -Os -Wl,-gc-sections, compared to 253,652 bytes for just -Os.

      Wow, 73.5 KB. That's a lot of dead code. I was kind of surprised the first time I ran into -gc-sections; linkers I'd used before GNU ld eliminated dead code by default. ld does some elimination by default, but you have to turn on gc-sections to get it to do it thoroughly. Are those numbers with exceptions turned off? And are you linking in iostreams to that? It still seems awfully large.

      --
      Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
    2. Re:Thanks for the -Wl,-gc-sections by tepples · · Score: 1

      Iostreams is big. I really like C++ but that's one part of it that I've never really been a fan of. I prefer the compactness of printf format strings. Same here. I normally use <cstdio> in code. I talk about <iostream> because a lot of people I've run into complain that a C++ program that uses <cstdio> doesn't "really use C++".

      Yeah, that's one of the best things about uclibc(++). No locales, no wchars. Today I tried to configure uClibc++, but I've run into a couple roadblocks. Can we take this to private e-mail or chat?

      It ought to be possible to lose the floating point emulator if you're not doing any FP work, though you might have to use a customized printf that doesn't include FP support. Yes, in fact, newlib has iprintf(), siprintf(), etc. I also saw an option in uClibc++'s make config (couldn't run make menuconfig because my MinGW doesn't have ncurses) for not building the floating-point parts of the library.

      Are those numbers with exceptions turned off? And are you linking in iostreams to that? It still seems awfully large. Yes, that was still my <iostream> example, with -fno-exceptions.
    3. Re:Thanks for the -Wl,-gc-sections by swillden · · Score: 1

      Same here. I normally use in code. I talk about because a lot of people I've run into complain that a C++ program that uses doesn't "really use C++".

      Bah, humbug. Now, a C++ program that doesn't use the std::string, std::vector, etc., doesn't really use C++ ;-)

      IMO, the greatness and difficulty of C++ both come from the same source: The depth and breadth of options the programmer has when using the language. A real C++ programmer applies the right subset to the job. I actually do use iostreams occasionally, for some things it's vastly better than printf -- especially the fact that you can overload operator<&lt(); for your classes. In other cases printf and its variants are a better choice.

      Today I tried to configure uClibc++, but I've run into a couple roadblocks. Can we take this to private e-mail or chat?

      I have no problem with that. My e-mail address is on my posts. However, I don't think you'll find me to be a lot of help. It's been quite a while since I did any real embedded work (my last "embedded" device had 64 MB RAM and ran full-on Linux with applications mostly written in Java) so my knowledge of uclibc etc. is mostly from the mailing lists I read trying to keep up with things. You'll get much better help from the project mailing lists. Most of what I've read about was people building GNU libstdc++ with uClibc. I hadn't heard of uClibc++ until you mentioned it, and I see the project page describes it as "alpha" software.

      Yes, that was still my example, with -fno-exceptions.

      That seems reasonable, then.

      --
      Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
    4. Re:Thanks for the -Wl,-gc-sections by jgrahn · · Score: 1

      Iostreams is big. I really like C++ but that's one part of it that I've never really been a fan of. I prefer the compactness of printf format strings.

      printf() is nice -- as long as you know at compile time the types of all arguments, and never print any types except the handful which printf() supports ...

    5. Re:Thanks for the -Wl,-gc-sections by swillden · · Score: 1

      Iostreams is big. I really like C++ but that's one part of it that I've never really been a fan of. I prefer the compactness of printf format strings.

      printf() is nice -- as long as you know at compile time the types of all arguments, and never print any types except the handful which printf() supports ...

      Iostreams insertion operators also have to know the compile-time types of all arguments. C++ polymorphism is dynamic only on the object (in this case the ostream), not the parameters. Your other comment is correct, of course, and there's the additional fact that iostreams provides type-safety that printf does not, making iostreams less error-prone.

      --
      Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
  77. The future is not C. by mastermemorex · · Score: 1

    I want to argue that C syntax is developed to work only a CPU. If you want to make a code for a GPU for example there is a language with similar syntax to C say HLSL or GLSL or Cg. And the future is GPU, FPGA, parallel computing, multithreading clustering and specialized hardware. As long as C cannot extend its primitives to vertor3f or matrix44 and able to unified all the hardware improvements this language is dead in less than one decade or sooner. Maybe it must be something between C and the assembler, lets say B?

    For me C++ is also almost dead. As a programmer I need something that works and makes my job easier. And I cannot wait to have multithreading, garbage collector, metaprogramming, modularity, standard GUIs and so on while this features has been running a loong ago, since the mid 90's. I like some aspects of C# and I dislike some other aspects, but rather prefer a lot over C++, nevertheless its design has a breach between native C and I think it is intentionally.

    I agree to use the right tool for the right job. Well I have a problem. Maybe someone can help me. I have to use a library that has been developed during 8 years and it is made in C. No mention the library is huge and it takes 15 minutes to compile and to miss "xxx.h" makes me waste ours of work time. Now let's move some of the core algorithms to run them in a GPU. So let's introduce another compiler (CUDA if you ask) to the project. But now it comes the best. Let's add another layer so we can have a GUI application over OpenGL. Cannot be C. C++ is insane. Maybe C#, Java? How I link it to the core? This project is insane, isn't it?

    I have seen D for a while and it looks like very promising I think I will start to support it with some modest contribution.

  78. Re:C Plus Plus Bye Bye by khuber · · Score: 1

    There are several Lisp-like DSLs (scheme for GIMP, Emacs Lisp), but I don't think that implies at all that Lisp is a good general purpose language for developing applications. Honestly I think it's just an easy language to implement (poorly :-). My understanding is that different Lisps have different sets of libraries and compatibility issues. Lisp has had 50 years to take over the world and it hasn't.

  79. "We don't have a marketing organization." by Futurepower(R) · · Score: 1

    At 21:33 minutes into the video, Dr. Stroustrup says, "We don't have a marketing organization."

    I think C++ needs a marketing organization. At present C++ suffers enormously from ignorance concerning the language and concerning how other languages compare, in my opinion.

    For example, what about the ease of decompilation of Java and C#? Why don't Sun and Microsoft write their products in those languages? Why are those languages made for others to use? What economic advantage is there in providing a language that only other people will use?

  80. Has anyone watched this yet? by Anonymous Coward · · Score: 0

    I can't get the stupid thing to download, been trying ever since the article was posted. Yea, real genius guys, put a 660 MB file on a server that can support a maximum of 5k / second transfers and resets your connection after you download 10MB. Put up a f'ing transcript.

  81. Re:C Plus Plus Bye Bye by NoOneInParticular · · Score: 1

    Java is not slow. It's not blazingly fast either, but it sure isn't slow. What financial institutions do is to throw twice the hardware at the problem, instead of 5 times the manpower. And funnily enough, I love C++, and love to hate Java, but not for its speed.

  82. Most people don't have more brainpower available. by Futurepower(R) · · Score: 1

    At 29:41 minutes, Dr. Stroustrup says, "People don't really want to worry about these big things", referring to issues that require a lot of thought.

    That's where more leadership is needed. Perhaps a special committee could be formed and advertised as a group of people who must have plenty of available brainpower. Most people use almost all their available brainpower at work, so should not join such a committee.

  83. Clumsy, unintuitive and buggy by mastermemorex · · Score: 1

    Just take a look to this as an example to how frustrating, clumsy and unintuitive C++ can be.
    http://www.allegro.cc/forums/thread/552652

    A dozen of forms to write the same simple task and none of them and the most intuitive is incorrect and a dozen more that leads to memory fragmentation or memory leaks.

    But look the new C++09.
    http://en.wikipedia.org/wiki/C++0x

    It is a montruosity of language. It will be even more unintuitive, harder and frustrating.

    My fellows are not programmers, they are mathematicias and engineers. I am the only one who has a little knodlegde to make an average robust code, but I am still making embarrased mistakes. In my job I had a whole week wasted because someone made a memory leak.

    Bjarne Stroustrup said that we should not relay on propietary languages. In the future, while propietary languages will be incompatibles, certainly and he promise, C++ will be still there.

    I see another future!. I see Bjarne Stroustrup is retired and fishing in a lake and the whole old school with him. C++ slowly abandoned without ceremony while the fresh blood are programming in C# using .Net technology.

    There are too many aspects that a dislike on C#, but. Hey! Out of there, there are real people with real jobs that need their work done. At this moment C# is a light year beyond. In least than five years of existence of .Net there is a 3.0 version coming and everybody programming in C#.

    No matters how we cry out about the devil strategies of M$ and the poor performance of its products. That M$ blah...blah.... Every one will be dancing under M$ song. This time they are doing damn good well.

    And if the Linux community still relay in C++ as their main language the community will be knocked down before knowing who strikes you. In this world we should think fast, move fast or your are obsolette. C++ is still there because of its enormous inertia. But it is a dying language.

    1. Re:Clumsy, unintuitive and buggy by EsbenMoseHansen · · Score: 1

      Just take a look to this as an example to how frustrating, clumsy and unintuitive C++ can be.
      http://www.allegro.cc/forums/thread/552652

      A dozen of forms to write the same simple task and none of them and the most intuitive is incorrect and a dozen more that leads to memory fragmentation or memory leaks.

      Really? I found this snippet, which was how I first thought to write it (I cleaned it up a little bit):

      #include <utility>

      std::pair<int,int> get_coord(int num)
      {
      return std::make_pair(num/30, num%30);
      }

      How much more intuitive can you get? You want to return a pair of ints. So say so. And then use make_pair() to do the heavy lifting. Doesn't get much simpler, does it? Now, I know what you are hinting at. Yes, being able to have real support for multiple return values is something that C++ is missing. I do regard it as an advanced topic though; in most cases (like the above) wanting to return multiple value is a sign of bad design. In the above case, the programmer should have returned some class representing a coordinate. Possibly derived (privately, of course) from std::pair.

      But look the new C++09.
      http://en.wikipedia.org/wiki/C++0x

      I have looked, and I am mostly thrilled. Getting operator. and operator.= will lift the language quite a bit, as will the typeof operator, making a better lambda() possible. operator.= (assignment to member variable) will be useful to any newbie. Lambda is for people who know what they are doing.

      It is a montruosity of language. It will be even more unintuitive, harder and frustrating.

      I do not find it so --- it's a hard but powerful language. If it's too hard for you, pick one of the dumped-down versions (Java, C#) or better yet, pick a language that is just more suited for your task, sacrificing power for generality.

      My fellows are not programmers, they are mathematicias and engineers. I am the only one who has a little knodlegde to make an average robust code, but I am still making embarrased mistakes. In my job I had a whole week wasted because someone made a memory leak.

      I am a mathmatician, but also a fairly experienced programmer. However, novice programmers and expert languages are not a good mix. Why not use a language geared at mathematics? Perhaps octave?

      Bjarne Stroustrup said that we should not relay on propietary languages. In the future, while propietary languages will be incompatibles, certainly and he promise, C++ will be still there.

      Well, true enough, but hardly the point I was trying to make. Anyway, there are tons of non-proprietary languages.

      I see another future!. I see Bjarne Stroustrup is retired and fishing in a lake and the whole old school with him. C++ slowly abandoned without ceremony while the fresh blood are programming in C# using .Net technology.

      C++ has been with us for a long time, and is still quite popular. But who knows? Maybe the functional languages like Haskell or Lisp will finally make it. Or something else. C# is a Java clone from what I hear, but more like C++? I regard both as Fortran replacement. There are too many aspects that a dislike on C#, but. Hey! Out of there, there are real people with real jobs that need their work done. At this moment C# is a light year beyond. In least than five years of existence of .Net there is a 3.0 version coming and everybody programming in C#.

      Had a bit too much propaganda there? :p I thought to look into Mono someday, just to round out my skills a bit, but I prefer to keep my real jobs in real languages. At the moment, that would be C++, ruby and perl, dependent on the task.

      No matters how we cry out about the devil strategies of M$

      --
      Religion is regarded by the common people as true, by the wise as false, and by rulers as useful.
  84. Correction... forgot about slashdot char filter by ardor · · Score: 1

    Another example: math vectors.

    Basic: template < typename NumericT, unsigned int Dimension > class Vec;

    There are functions for adding, subtracting, normalizing, calculating dot products etc. of a Vec class.

    And for Vec < NumericT, 3 > there is also a function cross(), which calculates the cross product of 3D vectors.
    Did Vec fail? No, of course not. It is an improvement; I *add* functionality for special cases (here, a cross product). For 4-D vectors, I could add functionality to treat the vector as a quaternion for example. You call this a failure?

    --
    This sig does not contain any SCO code.
  85. C++ is dying while C is thriving by MobyDisk · · Score: 2, Interesting

    What is odd to me is that I see new stuff written in C all the time for embedded systems, *nix code, drivers, etc. It's odd because C++ is merely language extensions on top of C. There's really no down-side to using C++ at all (queue the thread of trolls telling me how awful OOP is and why C++ forces them to use it). My guess is that the problem is g++: I am currently writing some code for the Nintendo DS, and if I compile it in gcc the code is 100k smaller than when I compile the same thing in g++, even before using the OOP features. I don't know why, but I know other people have reported the same issues. This is perpetuatating the myths that C++ is bloated. Really, we need C++ in a lot of ways but the tools are making it look bad.