Slashdot Mirror


Latest Proposals for C++0x

CodeDemon writes "It looks like the ISO/IEC JTC1/SC22/WG21 working group has made some headway in reviewing new proposals for the C++ language. The long anticipated upgrade for C++, C++0x, may be just around the corner. Head on over to check out the proposals yourself."

911 comments

  1. It keeps going and going.... by deman1985 · · Score: 4, Funny

    And I thought the next version of C would be +++... and then ++++

    1. Re:It keeps going and going.... by Anonymous Coward · · Score: 4, Funny

      C++H0--NO CARRIER!

    2. Re:It keeps going and going.... by bluethundr · · Score: 2, Informative

      And I thought the next version of C would be +++... and then ++++

      Well, since there was never a "C+" language, and you increment variables by one with "++" (hence the inherent joke in the name "c++"..."c incremented by one") a more logical construct would be (c++)++

      --
      Quod scripsi, scripsi.
    3. Re:It keeps going and going.... by kevinank · · Score: 5, Funny
      Well, since there was never a "C+" language, and you increment variables by one with "++" (hence the inherent joke in the name "c++"..."c incremented by one") a more logical construct would be (c++)++

      I'm rooting for C+=2.

      --
      LibBT: BitTorrent for C - small - fast - clean (Now Versio
    4. Re:It keeps going and going.... by MouseR · · Score: 4, Funny

      Actually, I would have chosen ++c++;

    5. Re:It keeps going and going.... by Hard_Code · · Score: 1

      Actually (c++) is not an l-value is it?...I don't think you can assign to it...

      --

      It's 10 PM. Do you know if you're un-American?
    6. Re:It keeps going and going.... by Davorama · · Score: 4, Funny

      Nah, it should become C double plus good...

      --

      Davo -- Free speech, free software, AND free beer.

    7. Re:It keeps going and going.... by Anonymous Coward · · Score: 0

      Yes, I see the pattern: C+ was the development version. C++ is stable. Now they're branching another 'odd +' version, right?

    8. Re:It keeps going and going.... by inertia187 · · Score: 1

      In Java, you're allowed to have:

      ++c++ ;

      --
      A programmer is a machine for converting coffee into code.
    9. Re:It keeps going and going.... by Anonymous Coward · · Score: 0

      Um, most people use C++ so they don't have to use Java.

    10. Re:It keeps going and going.... by Hard_Code · · Score: 1

      No you are not. Only as an expression, not a statement.

      --

      It's 10 PM. Do you know if you're un-American?
    11. Re:It keeps going and going.... by bluethundr · · Score: 1

      Actually (c++) is not an l-value is it?...I don't think you can assign to it...

      I forgot to mention that my little proglet had a few other lines other than the one mentioned.

      int main()
      {
      int h0wm4n33k0xj00rm4m45ux0rz;
      cout >> "How many: "; cin (pretendyouseetheinputoperator)h0wm4n33k0xj00rm4m4 5ux0rz;
      c = h0wm4n33k0xj00rm4m45ux0rz;
      if(c){
      (c++)++;}
      }

      --
      Quod scripsi, scripsi.
    12. Re:It keeps going and going.... by Anonymous Coward · · Score: 0

      I'm rooting for C+=2

      Or how about COOL (C Object-Oriented Language). At leat the name would be cool, if nothing else.

    13. Re:It keeps going and going.... by Cinematique · · Score: 4, Funny

      It'd be like eBay feedback...

      Great language!! Would code in again!!! C++++++++++++++++++

    14. Re:It keeps going and going.... by Speare · · Score: 4, Funny

      And the other joke of an Object-Oriented COBOL being named, ADD ONE TO COBOL.

      --
      [ .sig file not found ]
    15. Re:It keeps going and going.... by pr0nbot · · Score: 0, Redundant

      How about ++c++ ?

    16. Re:It keeps going and going.... by mog · · Score: 1

      Just because it's cool doesn't mean it doesn't suck.

    17. Re:It keeps going and going.... by j7953 · · Score: 4, Funny
      hence the inherent joke in the name "c++"..."c incremented by one"

      Yes, but it's postincrement, so the result is still C without any added value ;-)

      --
      Sig (appended to the end of comments I post, 54 chars)
    18. Re:It keeps going and going.... by zangdesign · · Score: 1

      How C++EvilBit?

      (OK, lame, but I just woke up ...)

      --
      To celebrate the occasion of my 1000th post, I will post no more forever on Slashdot. Goodbye.
    19. Re:It keeps going and going.... by mystran · · Score: 1

      actually, I think the behaviour of this construct is undefined in current languages.

      --
      Software should be free as in speech, but if we also get some free beer, all the better.
    20. Re:It keeps going and going.... by stonecypher · · Score: 1

      The old joke is that the language always should have been called ++c, but that since features were tacked on rather than planned in, that postincrement is maybe the best expression of what happened.

      Frankly, I'm rooting for "P". D, indeed. Like you guys don't know why there wasn't an "A".

      --
      StoneCypher is Full of BS
    21. Re:It keeps going and going.... by johnnyb · · Score: 1

      That's true for most C++ constructs.

    22. Re:It keeps going and going.... by clarkcox3 · · Score: 2, Interesting

      Except that

      (C++)++ invokes undefined behavior, because you're altering the same variable twice before the next sequence point.

      --
      There are no tiger attacks in my area and it's all because this rock I'm holding keeps the tigers away.
    23. Re:It keeps going and going.... by blibbleblobble · · Score: 1

      "Nah, it should become C double plus good..."

      Full speed C or high speed C?

    24. Re:It keeps going and going.... by Sri+Lumpa · · Score: 2, Funny

      Or depending on your point of view "C double plus ungood". Let the flamewars begin!

      --
      "The obvious mathematical breakthrough would be development of an easy way to factor large prime numbers." Bill Gates,
    25. Re:It keeps going and going.... by cait56 · · Score: 0, Redundant

      No 'C++' returns the current value of 'C', but then increments 'C', so that 'C' now has a higher value.

      An amazingly accurate self-assessment.

    26. Re:It keeps going and going.... by Anonymous Coward · · Score: 0

      Forget scalability and so forth, ++ requires an l-value, but yields an r-value. Chaining ++ is thus not possible without temporary vars (and no, parentheses do not perform so sort of magic fairy r-value to l-value conversion).

      Sorry friends, it's going to have to be C+=2, C+=4, ... by the language's own definition ;)

    27. Re:It keeps going and going.... by angrytuna · · Score: 1

      How about C++ full speed?

      --

      It is a solemn thought: dead, the noblest man's meat is inferior to pork.

    28. Re:It keeps going and going.... by Anonymous Coward · · Score: 0

      That's why the GNU Fortran 77 compiler is
      called g77.

      It's (f+1)77.

      Toon Moene.

    29. Re:It keeps going and going.... by Kirellii · · Score: 1

      I already chose Cgold, but unfortunately I think C$ is the one that will stick in the Business Realm.

    30. Re:It keeps going and going.... by kenthorvath · · Score: 1
      Or depending on your point of view "C double plus ungood".

      Parent post double plus ungood refs unpersons...

    31. Re:It keeps going and going.... by smittyoneeach · · Score: 1
      if (c==2)
      {
      c+=2; //c=4
      }

      Driving the c++ concept just a little further down the road to absurdity, we now open the door for:

      c4 //a really explosive language

      cIV //c++ is now taken intravenously, or is revealed to be a conspiracy run by Sid Meier.

      All jokes aside, the future of c++ is boost. Boost is the only way c++ can hope to stay abreast of the scripting languages and Java.

      --
      Get thee glass eyes, and, like a scurvy politician, seem to see things thou dost not.--King Lear
    32. Re:It keeps going and going.... by mackman · · Score: 1

      You are, of course, referring to C++84, which Microsoft later renamed C# and destroyed all evidence of its original name.

    33. Re:It keeps going and going.... by Regul8or · · Score: 1

      Can we leave the lowercase "x" out. Please, I think it has been worn out already. That "x" is so 2002.

    34. Re:It keeps going and going.... by stikves · · Score: 1

      Yes, but

      ++(++c)

      works on most C compilers.

      (++c) is defined as a reference, while (c++) is a value.

    35. Re:It keeps going and going.... by clarkcox3 · · Score: 1

      Whether or not it "works" is irrelevant, it still invokes undefined behavior.

      --
      There are no tiger attacks in my area and it's all because this rock I'm holding keeps the tigers away.
  2. why not... by darth_MALL · · Score: 3, Funny

    ...make it like grade school and just give the poor bastard a "B". Enough already ;)

    1. Re:why not... by PetWolverine · · Score: 1

      'Cause the names A and B were taken.

      --
      I found the meaning of life the other day, but I had write-only access.
    2. Re:why not... by Worminater · · Score: 1

      Aldready been done:-p Now if ya got creative and did if ("c++" + "a" == "d++")

    3. Re:why not... by Tony+Hoyle · · Score: 3, Informative

      B actually existed... it was the language that predated C.

      I've no idea if there was an A though.

    4. Re:why not... by mattdm · · Score: 3, Informative

      The B programming language stemmed from one called BCPL. Therefore, the logical successor is P, not D.

    5. Re:why not... by Anonymous Coward · · Score: 0
      The B programming language stemmed from one called BCPL. Therefore, the logical successor is P, not D.

      Besides, 'D' is already taken

  3. C++0x? by awtbfb · · Score: 0, Redundant


    How about upping the name to D?

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

      I always thought you'd up it to B.

      I know in grade school it went C, C+, C++ (tho those were only from bastard teachers :) ), B-, B, B+, etc.

      Personally I wouldn't mind seeing B- :P

    2. Re:C++0x? by AssFace · · Score: 1

      Isn't it technically already an implied D?
      (we have used C, and then after that incremented it to D)

      So it would actually be better to have the new one called "D++"?

      --

      There are some odd things afoot now, in the Villa Straylight.
    3. Re:C++0x? by Anonymous Coward · · Score: 0

      It's taken.

    4. Re:C++0x? by Randolpho · · Score: 2, Informative

      Already done!

      D Programming Language

      --
      "Times have not become more violent. They have just become more televised."
      -Marilyn Manson
    5. Re:C++0x? by nocomment · · Score: 1

      How about upping the name to D?
      Don't you mean B-?

      I see a lot of requests to _add_ things. Is there anything that should be put in as a request for removal?

      --
      /* oops I accidentally made a comment, sorry */
      /* http://allyourbasearebelongto.us */
    6. Re:C++0x? by bluethundr · · Score: 1

      How about upping the name to D?

      Makes sense to me. Dennis Ritchie and fellows decided to call C "C" because it was the successor to a language called "B". B stood for "Bell" as in Bell Labs where both those languages (as well as C++) were invented. The lab is located (still) at a place called Murray Hill NJ. Not sure where "X" was developed, though I think it might have been Berkeley. "X" of course was developed as the successor to "W" which stood for (brace yourself) "Windows". What will these brilliant engineers think of next? ;)

      --
      Quod scripsi, scripsi.
    7. Re:C++0x? by nusuth · · Score: 2, Funny

      If there is any progress, the new language should be at least ++C. You see, C++ is better than C but all you have is the C before C++.

      --

      Gentlemen, you can't fight in here, this is the War Room!

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

      Because B alread exists, it was infact it was a very early version of C.

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

      I'd say C is a very late version of B, and B is a very late version of A. But I could be wrong.

      --
      I found the meaning of life the other day, but I had write-only access.
    10. Re:C++0x? by PetWolverine · · Score: 1

      Then next, we could make it D++0x. How do you pronounce that in 1337 speak?

      --
      I found the meaning of life the other day, but I had write-only access.
    11. Re:C++0x? by AssFace · · Score: 1

      and I think in terms of performance in C, "++C" instead of "C++" is faster and more efficient since it can just dump over it instead of using it first and then incrementing it up.

      I haven't bothered testing it in C++, but it should be faster in anything I would imagine for the same reason.

      So if C++ is theoretically D (assuming that we have already used C, and therefore have something new) - ignoring that language already exists and is different - then the new language should actually now be E...
      So why don't we do --F so that we get the better performance of prepending instead of postpending (although it is removal in this case) and then we are doing something different for a change and going down to E.

      I don't know, I'm just rambling.

      the reality of it is that it isn't a new language, just an update to C++, so there is no new name.

      we are just geeks and this is how we have fun I guess. if only I wore glasses, then I'd push them up my nose right now and chortle.

      --

      There are some odd things afoot now, in the Villa Straylight.
    12. Re:C++0x? by plalonde2 · · Score: 1

      First there was BCPL, which engendered B, then C, named by the next letter in BCPL. Ergo, the next language should be called P Paul

    13. Re:C++0x? by AssFace · · Score: 1

      detox?

      --

      There are some odd things afoot now, in the Villa Straylight.
    14. Re:C++0x? by Anonymous Coward · · Score: 2, Interesting

      From the Jargon:
      C n. [..] 3. The name of a programming language designed by Dennis Ritchie during the early 1970s and immediately used to reimplement Unix; so called because many features derived from an earlier compiler named `B' in commemoration of its parent, BCPL. (BCPL was in turn descended from an earlier Algol-derived language, CPL.) Before Bjarne Stroustrup settled the question by designing C++, there was a humorous debate over whether C's successor should be named `D' or `P'.[..]

    15. Re:C++0x? by pstreck · · Score: 1

      There's already a D, learn about it at http://www.digitalmars.com/d/

      --

      Later,
      Phil
    16. Re:C++0x? by Anonymous Coward · · Score: 0

      I think the whoe C++ thing is ridiculous. C convention is using capital letters for #defined constants. As such you can't do anything to them but to refer to. Next iteration of the language should be named "Parse error in line 0."

    17. Re:C++0x? by CptNerd · · Score: 1

      X was developed at MIT at first, then some companies got involved, many of which no longer exist, like DEC and Apollo.

      Cap.

      --
      By the taping of my glasses, something geeky this way passes
    18. Re:C++0x? by bluethundr · · Score: 1

      X was developed at MIT at first, then some companies got involved, many of which no longer exist, like DEC and Apollo.

      Apollo was at one time in negotiation with Apple to produce a "personal workstation" derrived from the Mac II. But those talks stalled. That's really all I know about Apollo other than that they were a Unix workstation company.

      --
      Quod scripsi, scripsi.
    19. Re:C++0x? by macrom · · Score: 1

      Actually, we've started using a new language here at the office called Db. It's pretty much the same thing as C#.

    20. Re:C++0x? by tommck · · Score: 1
      Well, actually, ++C would have been the more optimal way to write it, since doing a "C++" requires the creation of a temporary variable in order to return the current value of C and increment it. So, it really should he ++C.

      T

      --
      ---- It puts the lotion on its skin or else it gets the hose again. It does this whenever it's told.
    21. Re:C++0x? by Anonymous Coward · · Score: 0
      I think HP bought apollo a few years back.


      At the time, HP was the #2 dumb term manufacturor, and apollo was #3.


      1 year after the merger, HP was the #5 dumb term manufacturor.

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

      Great!! ROTFL!

      This made my day. This is the funniest comment I've read on Slashdot in weeks.

      (of course there's a lot of non-musicians out there wondering, What the Heck....?)

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

      > I've...I've been living a lie...

      nope, just yet another marketting victim. Ok, maybe its the same thing....

    24. Re:C++0x? by blibbleblobble · · Score: 1

      "Personally I wouldn't mind seeing B-"

      Howabout B#

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

      Yeah, pretty damn funny. Wow. Amazing. And non-musicians probably don't even know what a note is, let alone D-flat and C-sharp. HAHA!

    26. Re:C++0x? by PetoskeyGuy · · Score: 1

      While the programmer types laugh at the musicians. He thinks we're talking about music.

      Here's a link check it out. By the way, .NET isn't for fishing either. ;)

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

      well, *I* thought it was funny....

    28. Re:C++0x? by God!+Awful+2 · · Score: 1

      Actually, about 10 years ago there was a windowing library for DOS called Db++.

      -a

  4. where does the name come from? by newsdee · · Score: 3, Interesting

    It may be a no-brainer for many of you, but can somebody enlighten me on why the name is C++0x? AFAIK C++ was named as such to indicate it was "more than C" [C++ is C = C+1 for the unlikely few who wouldn't know]. Is this the same kind of nomenclature (0x is zero in Hex), or is it something pronunciation-based ("plusox"?)...

    1. Re:where does the name come from? by Joe+Decker · · Score: 5, Informative

      Language revs are often referred to by the year of the completion of their standardizatioin (e.g., C++98.) The next C++ would presumably be somewhere in this decade, e.g., C++05 or so, but of course nobody is sure what year the work would be completed in, ergo C++0x.

    2. Re:where does the name come from? by the_2nd_coming · · Score: 2, Informative

      ummm...no.

      C++98
      C++0x.....the x will be replaced by a numberal for the year that the standard will finaly be ratified.

      --



      I am the Alpha and the Omega-3
    3. Re:where does the name come from? by alefbet · · Score: 4, Interesting

      The current version of C++ is often referred to as C++ 98 because it was finalized in 1998. The next standard should be finalized around 2007ish, so it's sometimes informally referred to as C++0x (think Windows 9x).

      --

      A hack is just an idiom waiting for wider use.
    4. Re:where does the name come from? by MrCocktail · · Score: 5, Insightful

      I too read it as "C++ followed by some hex number to be named later", but after skimming very quickly through the proposal, it seems they meant "C++ (20)0x, where x depends on whatever year the spec/implementation/whatever is released". Or, at least, that's what I think it means.

    5. Re:where does the name come from? by Epistax · · Score: 1

      It's actually Ox, not 0x. Ox - Oxford. At least the website sure makes it seem like that.

    6. Re:where does the name come from? by Anonymous Coward · · Score: 0

      That means the language is not year 2000 compatible :D double digit and not 4.

    7. Re:where does the name come from? by grub · · Score: 3, Funny


      "C++ is to C as Lung Cancer is to Lung"
      - a sig I read on slashdot

      --
      Trolling is a art,
    8. Re:where does the name come from? by Anonymous Coward · · Score: 0

      So, you have to be smoking something for it to develop?

    9. Re:where does the name come from? by Arslan+ibn+Da'ud · · Score: 1
      C++0x.....the x will be replaced by a numberal for the year that the standard will finaly be ratified.
      Sigh. You mean, even at this late date, C++ is not Year-2000 compliant???
      --

      Practice Kind Randomness and Beautiful Acts of Nonsense.

    10. Re:where does the name come from? by JanneM · · Score: 3, Funny

      Hmm. Obscure notation, explained indirectly in a section about something else. Yep, it's a good notation for C++ versioning all right.

      --
      Trust the Computer. The Computer is your friend.
    11. Re:where does the name come from? by Andorion · · Score: 1

      It's a zero, not an "O", and he's right... it stands for "C++ 200x", following the current C++98.

      ~Berj

    12. Re:where does the name come from? by delphi125 · · Score: 1

      No Bjarney is trying a witticism - the 0x prefix is used in C to indicate hex. Having it as a suffix would presumable come under the heading of 'remove embarrassments'. Anyway the sequel to C should have been named D or P, so this effort should be E or L, I suppose.

    13. Re:where does the name come from? by IWannaBeAnAC · · Score: 1

      No, the parent was correct. The name C++0x has been around for several years, at least. It signifies the intent to ratify the next version of the ISO standard sometime in this decade.

    14. Re:where does the name come from? by Zathrus · · Score: 1

      It's the notation used by ALL standardized languages. If your particular language doesn't use it, it's because it's not a standardized language.

      Part of the standardization process involves making sure changes are not made to the language too fast. Once a standard is agreed upon no official discussion can be started about the next standard for 5 years. A vote cannot be taken for 10 years.

      The latest version of C is officially C99. But you don't refer to it as that... just as C. Whether or not your compiler is C99 compliant is only discernable by poking around the docs.

    15. Re:where does the name come from? by mgs1000 · · Score: 1

      I thought the '0x' denoted that it was in hexadecimal. (and maybe a little dyslectic)

    16. Re:where does the name come from? by Anonymous Coward · · Score: 0

      Actually (in C++, at least), c++ is not the same
      as c = c + 1. ++c is the same as c = c + 1.

      int c = 1;
      int x = c++;
      c = 1;
      int y = (c = c + 1);
      cout << "x = " << x << endl;
      cout << "y = " << y << endl;

      Output:
      x = 1
      y = 2

    17. Re:where does the name come from? by drj11 · · Score: 1

      A new C++ this decade. :-).

      I'm willing to bet that x >= 0xA for this C++0x.

    18. Re:where does the name come from? by Anonymous Coward · · Score: 0

      It signifies the intent to ratify the next version of the ISO standard sometime in this decade.

      Optimistic, aren't they?

    19. Re:where does the name come from? by EvanED · · Score: 1

      The working draft of C++98 was finished in 1994 I think and ratified 4 years later, so I'd say they'll make it.

    20. Re:where does the name come from? by EvanED · · Score: 1

      Yes, but the language isn't called "X=C++", is it? As a statement, i.e.

      int c=0;
      c++;
      ++c;

      Both do the some thing. (If they don't, you've don' a very poor job of operator overloading.)

      (Actually, for classes with the operators overloaded, c++ usually has to make a temporary to return from operator++ while the prefix ++ doesn't, but as the temporary is destroyed at the end of statement they are both essentially the same thing provided neither construction nor destruction has side effects.)

    21. Re:where does the name come from? by Mignon · · Score: 4, Funny
      C++98 ... C++05

      Didn't we learn anything from Y2K? How am I going to tell the difference betwen code written to the C++ 2005 standard and the C++ 1905 standard?

    22. Re:where does the name come from? by tgburrin · · Score: 1

      Should just keep the "x" and make it like an ascii character. C++0x03 = C++ end of text? C++0x06 = ACK edition?

    23. Re:where does the name come from? by ZamesC · · Score: 1

      The 1994 Working draft was quite different than the final draft that was ratified four years later. First of all, the STL was added in 1995, and that caused changes rippling through the entire library. (ie, the string class was toss out and restarted from scratch to be more stl like). Also the templatizing of iostreams didn't start until 1995.

    24. Re:where does the name come from? by jdennett · · Score: 2, Informative

      Yes, it's C++0x for 2000-and-something, because we hope to get the next major revision of the C++ Standard out before 2010. A minor revision is going through the process of being published around now, but that just fixes defects in C++98, as the original ANSI/ISO/IEC 14882:1998 standard is informally know.

    25. Re:where does the name come from? by ZamesC · · Score: 1

      Not, it's Zero-X. (though it's pronounced "oh-x"). Oxford, England was the location of the last meeting. (The committee mets twice a year, once inside North America, and once outside). Traditionally, just prior to each meeting, every member would be shipped a big package of all the papers that would be dealt with out the meeting, and afterwards, another package with all the revised papers to reflect discussions at the meeting. (I said "traditionally", as shipping paper documents became too expensive, so now it's all done in email, which negates the need for one big package of all the papers). Anyway, these documents packages are called the "pre-(location)" and "post-(location)" mailings. The link in the opening article pointed to a document in "post-Oxford mailing". I believe the next one (in the fall) will be in Kona, Hawaii, so those documents will be called the "pre-Kona" and the "post-Kona"

    26. Re:where does the name come from? by pmz · · Score: 1

      "plusox"

      Perhaps they are referring to the weight of the new spec document (i.e., this thing weighs more than livestock, now).

      In college, a professor provided a very concise argument for why we were learning Scheme instead of C++. All he did was hold up the C++ spec (several inches thick, duplex) and, then, hold up the Scheme spec (a pamphlet, by comparison).

      And, I do remember Scheme being very easy to learn. I also remember a later class project, where a one-page Scheme-based compiler for some sort of combinatoric expression language took thousands of lines of C++ code to re-implement.

      It's too bad there are so many cultural stigmas against Lisp and Scheme (picture freshly hatched contractor-babies saying "Ewwww...Lisp? XML is a much better scripting programmatical language" and trying really hard not to punch them).

    27. Re:where does the name come from? by jdennett · · Score: 2, Informative

      The original C++ is informally known as C++98, because it is defined by the International Standard ISO/IEC 14882:1998 (also adopted by ANSI).

      A minor update to that standard will be published very shortly, depending on how the ISO machine works. That won't be what we're calling C++0x, it'll just be fixes for errors in C++98.

      C++0x is the name given to the next major version of the C++ Standard, and it's some years away yet: expect 'x' to be large! Between now than and then there will be a "technical report", proposing extensions to the C++ library. It is likely to be widely supported, but a "technical report" (often abbreviated to TR) doesn't have the weight of a full ISO standard.

      I really ought to update the comp.std.c++ FAQ to cover this...

    28. Re:where does the name come from? by IWannaBeAnAC · · Score: 1
      Yeah but no one is planning anything nearly that big for C++0x. In fact, any big proposal of the likes of those from 94 to 98 is guaranteed to be shot down in flames this time around.

      The 'late' changes to the C++98 standard were almost all beneficial, and it is a significantly better language than that envisaged in 1994. But I think the committee also recognize that the time for rampant additional features without an implementation and without real-world (or even experimental) experience, is over.

      I think everyone on the committee is dedicated to having the next standard out in good time. Well, I hope :-)

    29. Re:where does the name come from? by EvanED · · Score: 1

      Yeah, I know. I worded my post poorly... I should have said the standard was ratified 4 years later. I have a suspicion that the changes between the working draft and the final 1998 standard will be even greater than the changes between the draft and standard with C++0x as there is already a formal standard that they are working off of rather than the ARM.

    30. Re:where does the name come from? by jdennett · · Score: 1

      Indeed, the final text of the first C++ standard wasn't ready until 1997, and became an International Standard the following year.

    31. Re:where does the name come from? by Matthew+Austern · · Score: 1

      The name isn't C++0x. The name will be C++. People are informally saying "C++0x" in the same way they were saying C9x: because it's expected that the next revision of the C++ standard will be released some time within the next seven years. Similarly, people informally refer to "C++98", meaning C++ as described in the 1999 ISO standard.

      It's the same deal as with C: people sometimes refer to "C90" (i.e. the version of C specified in the 1994 ISO standard), "C94" (C90 plus the 1994 normative addendum), and "C99" (the version of C specified in the 1999 ISO standard).

    32. Re:where does the name come from? by xigxag · · Score: 1

      Considering that they haven't gotten past the stage of "crappy powerpoint slides" and "committee-to-form a committee," shouldn't the working name be more like C++2x?

      --
      There are two kinds of people: 1) those who start arrays with one and 1) those who start them with zero.
    33. Re:where does the name come from? by Anonymous Coward · · Score: 0

      That name would be 2 fast and 2 furious.

    34. Re:where does the name come from? by JewFish · · Score: 1

      When I asked the man about C++0x, I called it C++ "knot" beacuse I had heard it pronounced similarly before. Stroustrup called it C++ zero x, but he had obviously heard it called "knot, not, naught" before since he knew what I was asking about it.

      All I could get out of him was that it was going to be some sort of update to the standard. It was an interesting conversation, and it ended by me getting my book signed by the man.

      If anyone knows where the "knot" came from, I would like to hear about it.

    35. Re:where does the name come from? by csguy314 · · Score: 1

      The code for 1905 is written on stone tablets... duh!

      --
      This is left as an exercise for the reader.
    36. Re:where does the name come from? by Matthew+Austern · · Score: 1

      "Naught", not "knot". It means the same thing as "zero".

    37. Re:where does the name come from? by Ben+Hutchings · · Score: 1

      The committee was never disbanded, so there is no need to form another committee. The new standard is expected to be ready around 2008. Meanwhile there will soon be issuing a Technical Report "advising" on new library features (that are then likely to go into the next standard).

    38. Re:where does the name come from? by Hudjakov · · Score: 0

      We have a vodka in Estonia named Y2k. Last time I tried it I drunk about 7th part of a gallon of it. Next thing I remember was a nice morning outside.
      I am drunk also as I write this comment. And yes, my father is russian. Seriously! I will never drink this vodka again!

    39. Re:where does the name come from? by Anonymous Coward · · Score: 0

      Didn't we learn anything from Y2K? How am I going to tell the difference betwen code written to the C++ 2005 standard and the C++ 1905 standard?

      No, if we learned anything from the Y2K fiasco, then you'd know the real problem is between the C++ 2005 standard and the C++ 2105 standard. Yesh, when will programmers learn to plan ahead.

    40. Re:where does the name come from? by Skjellifetti · · Score: 1

      The diff in size might just be a reflection of which language actually got used and developed a largish following. The early versions of C++ (C w/ classes) weren't too much bigger than C. Same w/ XML. The original XML was released in a little blue pamphlet of about 20 pages. Now we have XML, XPath, XMLSchema, and XMLCuresCancerAndCreatesWorldPeace. More users means more feature requests and more demands for better interoperability as ambiguities are found in the current standard. More features and better interoperability brings more users.

    41. Re:where does the name come from? by stikves · · Score: 1

      Since most programmer of that era probably died in World War I, we'd never know...

  5. Great... by tevenson · · Score: 1

    More changes to the standard so that the compilers can't keep up! Microsoft Visual Studio (6 or .NET) still can't handle templates correctly. For half the stuff I do I have to use gcc or VS shits itself. I guess gcc will always be what I use.

    1. Re:Great... by kannibal_klown · · Score: 2, Informative

      Version 6 sucked A$$, but Vis c++ .Net is actually pretty good. And wtf are you talking about, I've used templates before with .Net (2002 and 2003) and had no problem.

    2. Re:Great... by tevenson · · Score: 1

      When you get into doing some nasty template stuff (nested, etc...) .NET breaks. What are the main differences between 2002 and 2003? Perhaps I've got 2002 and 2003 fixes the issues.

    3. Re:Great... by AssFace · · Score: 0, Flamebait

      perhaps this explains why I sometimes shit myself when using templates.
      I had always blamed Korean food.

      --

      There are some odd things afoot now, in the Villa Straylight.
    4. Re:Great... by kannibal_klown · · Score: 1

      BTW, my templates were rather simple, so maybe you meant advanced templates. Also, by "good" I mean follows the standards a hell of a lot better than 6.

    5. Re:Great... by Anonymous Coward · · Score: 0

      Can VS.Net compile normal C code? Ie., non class based code (C++ objects).?

    6. Re:Great... by alefbet · · Score: 1
      Version 6 sucked A$$, but Vis c++ .Net is actually pretty good. And wtf are you talking about, I've used templates before with .Net (2002 and 2003) and had no problem.
      The areas where VC++ chokes on templates (both 6 and .net) are:
      • Partial template specialization (it doesn't do at all), and
      • Template member functions (it can't parse the syntax for defining the function body outside the class body, making the class definition really cluttered).
      Those are the things I've commonly run into, and why I'm in the middle of switching to gcc. Someone else may know of other things, but I think these are the two big ones.

      Of course, it also doesn't handle export, but almost no one does, and the standard is a bit foggy on it anyway.

      --

      A hack is just an idiom waiting for wider use.
    7. Re:Great... by Homology · · Score: 2, Informative
      The main difference is partial template specialization, apart from some speed optimizations.

      However, alot of code breaks when moving to VC .NET 2003 : for some reason they decided to remove classic headers, giving us _days_ of work. I've never had so much problems with a compiler as with VC .NET 2003 when trying to just build projects that have worked fine since VC 6.0.

    8. Re:Great... by Homology · · Score: 1
      The areas where VC++ chokes on templates (both 6 and .net) are:

      * Partial template specialization (it doesn't do at all), and

      VC .NET 2003 have this feature now, in contrast to VC .NET 2002 that implemented it partially (pun intended).

    9. Re:Great... by rekkanoryo · · Score: 1
      Ever try something like this?
      unsigned long long int varname;
      ANY windows compiler bitches like there's no tomorrow.
    10. Re:Great... by Anonymous Coward · · Score: 0

      Woah! You're right, VB6 just barfed on that!

    11. Re:Great... by be-fan · · Score: 2, Informative

      2003 is a great deal better than 2002. The version number of VC++ was only bumped to 7.1 from 7.0, but it was more of a 7.0 to 8.0 increase in compatibility. 7.1 is now on a par with GCC in terms of compatibility.

      --
      A deep unwavering belief is a sure sign you're missing something...
    12. Re:Great... by Malc · · Score: 2, Insightful

      Which headers? I see IOSTREAM.H isn't there anymore. All I can say is thank goodness. I've seen so many people in the last 5 years include that file when really they should have been including IOSTREAM. Mixing the iostream libraries can be very bad. Besides, IOSTREAM is more standards compliant than IOSTREAM.H. I've seen people get confused by the documentation and use features of IOSTREAM.H that were completely unportable to other platforms. Now nobody will be confused and development costs are reduced.

      If the upgrade was so expensive, you shouldn't have done it. We're still using MSVC 5 for some products, and MSVC 6 for most of the rest. Some small *new* products are now being developed in MSVC.Net, but we have to consider the cost of having code that might not be portable to older versions of the compiler. The cost of upgrading the older products cannot be justified, so we still use what works.

    13. Re:Great... by rekkanoryo · · Score: 1
      Let me clarify that remark...any windows C/C++ compiler bitches like there's no tomorrow. This includes Visual C++ (either 6 or .NET), all versions of Borland's C++ compiler, etc.

      I even have a string parser that can't compile on windows, but g++ compiles it perfectly (and the compiled version actually runs). If anyone wants the code, I'll release it as public domain. It was originally an assignment for procedrual C++.

    14. Re:Great... by Anonymous Coward · · Score: 0

      Yes. Why wouldn't it?

    15. Re:Great... by Anonymous Coward · · Score: 0

      Is there a reason a Microsoft compiler should support a gcc extension? Use __uint64.

    16. Re:Great... by macrom · · Score: 2, Insightful

      Classic headers (iostream.h, string.h, etc.) were deprecated in the 1998 Standard. You've had 5 years to remove them from your code. If you still have problems because you move to the latest compiler but don't move your code to the latest standards, then you have no one to blame but yourself. Well, maybe your manager, in which case I forgive you.

    17. Re:Great... by herbiee_ · · Score: 1

      So, this is valid c++ code? OK.. always knew that after three years of occasional use I was still a beginner, but not THAT much of a beginner.

    18. Re:Great... by rekkanoryo · · Score: 1

      It works with g++ and some other UNIX C++ compiler (forget the name of it, it was on a SCO server my stupid college had); if it isn't valid, why does it work?

    19. Re:Great... by Anonymous Coward · · Score: 0

      yeah, dog gives me wicked diarrhea too.

    20. Re:Great... by Anonymous Coward · · Score: 0

      This is not legal. "long long" is not part of C++-98; it's a GNU extension (it's also in C99, but C89, not C99 is incorporated into the C++ standard)

    21. Re:Great... by sebmol · · Score: 1

      There's no such thing as long long in the C++ standard. That g++ allows that is an invalid extension.

      --
      "Light is faster than sound." - "Is that why people tend to look bright until you hear them speak?"
    22. Re:Great... by Homology · · Score: 1

      In this we had little choice, I'm afraid. It's old code, and I regulary do small controlled cleanups to more modern C++. But I prefer not to have it rammed down my throat.

    23. Re:Great... by Homology · · Score: 1
      Try working on old legacy code in which none of the current developers has written. Upgrading code that was ported from Unix (Irix, really, with it's shitty compiler) to Windows is done by us in controlled testable stages.

      We write new modules to replace old code, but I need old and new code to interoperate until it's pahes out. Having VC playing tricks on me are _not_ appreciated.

    24. Re:Great... by Malc · · Score: 1

      It's hardly rammed down your throat. It's been documented since MSVC 6 was released all those years ago.

    25. Re:Great... by Malc · · Score: 1

      Oh come on. That goes for any compiler. Even switching between modern GCC and modern Sun Workshop Pro compiler is going to give you problems. I've had problems with 10 year old vanilla C code with gcc. MSVC hasn't played tricks on you... it has become *more* standards compliant, which seems to violate the preconceptions of most people around here. Go and read the Mozilla coding standards... you will find that you can't use 90% of C++ (when I read them a couple of years ago) due to problems between different compilers.

      Let's not forget, Stroustrup (sp?) ed. 2 only came out shortly before MSVC 6. Iostreams and STL were still extremely immature before that. So blame the developers of the day, not the tools of today.

    26. Re:Great... by Homology · · Score: 1
      MSVC hasn't played tricks on you... it has become *more* standards compliant, which seems to violate the preconceptions of most people around here.

      The impression from different programming jobs is that some programmers are very resistant to take advantage of what C++ and STL (and Boost) has to offer, and just continue to write mid 1980 C-style code. For a C-program this migth be fine, for an OO C++ program it sure isn't.

      My beef with VC this time was that I was forced to make quite a few changes to legacy code I plan to ditch later anyway.

    27. Re:Great... by rekkanoryo · · Score: 1

      OK, I'll accept that it's not legal in C++. But now if "long long" is part of C99 shouldn't VS.Net support it in a pure C program? I can understand VS6 not supporting it, since it's so old, but VS.Net is supposed to be more compliant with all the standards.

    28. Re:Great... by spitzak · · Score: 1

      The newest version of the Irix compilers are fixed so you can use the new headers on them. Right now they are better than VC++6. Have not had a chance to try VC++7 yet but I heard it was much better than 6.

    29. Re:Great... by Anonymous+Brave+Guy · · Score: 1
      Classic headers (iostream.h, string.h, etc.) were deprecated in the 1998 Standard.

      <iostream.h> was never a standard header. Many pre-standard compilers offered IOStreams functionality in such a header, although frequently with subtle differences from what you find in the standard <iostream> (not just the namespace issue).

      The old C headers (<string.h>, <math.h> and co) are explicitly supported but deprecated in C++, in the Compatibility Features annex of the standard. Similarly, there is also a mention in the standard of the old char* streams (strstream and friends) although these have also been superceded by the stringstream family.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    30. Re:Great... by Anonymous+Brave+Guy · · Score: 1

      From what little I've seen (as a VS.NET 2002 user considering upgrading) the 2003 edition is more of a "serious service pack" than a major new release, if you're only using it as a plain C++ compiler without all the .NETty bits. It fixes some bugs from the 2002 edition, reputedly improves the stability (although I can't comment on that either way from personal experience), and improves standards compliance in a few specific ways, notably in the templates area. The ability to use it with libraries like Loki and the Boost collection is one of Microsoft's marketing points, and I've yet to hear of serious complaints about that on the grapevine, so the template support must be fairly strong in the new edition.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  6. Supercalifragilisticexpialidocious! by Dark+Lord+Seth · · Score: 5, Funny
    ISO/IEC JTC1/SC22/WG21

    Someone try to say that ten times fast!

    1. Re:Supercalifragilisticexpialidocious! by donutz · · Score: 1

      Does typing it ten times fast count?

      ISO/IEC JTC1/SC22/WG21
      ISO/IEC JTC1/SC22/WG21
      ISO/IEC JTC1/SC22/WG21
      ISO/IEC JTC1/SC22/WG21
      ISO/IEC JTC1/SC22/WG21
      ISO/IEC JTC1/SC22/WG21
      ISO/IEC JTC1/SC22/WG21
      ISO/IEC JTC1/SC22/WG21
      ISO/IEC JTC1/SC22/WG21
      ISO/IEC JTC1/SC22/WG21

      Stupid lameness filter! How am I supposed to get in a quick stupid possibly moderate-able as funny comment if Slashcode decides it's too lame?

    2. Re:Supercalifragilisticexpialidocious! by paradesign · · Score: 2, Funny
      cheater! i bet you copy/pasted it ten times fast.

      yes, this is supposed to be funny

      --
      I want 2D games back.
    3. Re:Supercalifragilisticexpialidocious! by PetWolverine · · Score: 1

      What, as in +1 Flamebait? That should be an option...

      --
      I found the meaning of life the other day, but I had write-only access.
    4. Re:Supercalifragilisticexpialidocious! by Ricdude · · Score: 1

      I'm more impressed that supercalifragilisticexpialidocious was spelled correctly.

      --
      How's my programming? Call 1-800-DEV-NULL
    5. Re:Supercalifragilisticexpialidocious! by 56ker · · Score: 1

      For their next challenge they should try singing ISO/IEC JTC1/SC22/WG21 ten times to the tune of supercalifragilisticexpialidocious.

    6. Re:Supercalifragilisticexpialidocious! by Anonymous Coward · · Score: 0

      Your comment violated the "postercomment" compression filter. Try less whitespace and/or less repetition. Comment aborted.

      Sorry dude, I tried.

    7. Re:Supercalifragilisticexpialidocious! by Anonymous Coward · · Score: 0

      ok:
      that that that that that that that that that that
      [/pedant]

  7. C++0x ? by Cipster · · Score: 5, Funny

    Sounds like the l33t version of C++
    The hardest part is deschiphering the comments...

    1. Re:C++0x ? by theonetruekeebler · · Score: 1
      This is great! Now its name sounds like line noise, too!

      Maybe we could do this with Perl?

      --
      This is not my sandwich.
    2. Re:C++0x ? by Anonymous Coward · · Score: 0

      Oh, great. The next thing you know my inbox will be full of invitations to see "B16 C++0x"

  8. directions for C++? by Anonymous Coward · · Score: 1, Funny

    Calling a paper "Directions" is the quickest sure-fire way to ensure that _nobody_ will read it...

  9. Re:Whatever. by addaon · · Score: 2, Informative

    Um... C is C(\+)*.

    --

    I've had this sig for three days.
  10. A better name by earthforce_1 · · Score: 0, Redundant

    would be c+=2, with source files using the .cp2 extension. Can't be any worse than C++0x.

    I think "D" is already taken.

    --
    My rights don't need management.
    1. Re:A better name by usotsuki · · Score: 1

      Yep.

      http://www.digitalmars.com/d/index.html

      -uso.

      --
      Dreams, dreams, don't doubt dreams, dreaming children's dreaming dreams. Sailor Moon SS
    2. Re:A better name by emag · · Score: 1

      Looking through the linked PDF, it wasn't until slide #6 that it hit me what "C++0x" was, when I saw a reference to "C++98". "x" looks like it's a placeholder, but jeez, you'd think we'd have learned by now about using only 2 digits to denote a year!

      --
      "The urge to save humanity is almost always a false front for the urge to rule." --H.L. Mencken
    3. Re:A better name by p3d0 · · Score: 1

      Dude, C++0x is not the proposed name of the language.

      --
      Patrick Doyle
      I mod down every jackass who puts his moderation policy in his sig. Oh, wait a sec....
    4. Re:A better name by EvanED · · Score: 1

      Bingo. Languages are often referred to with the year of their standardization, e.g. C99, C++98 (the current standard). However, no one knows when the new standand will be ratified because it's rather difficult to see into the future, so it's referred to as C++0x with the x as a placeholder.

    5. Re:A better name by Tumbleweed · · Score: 1

      > so it's referred to as C++0x with the x as a placeholder

      Considering how long it's taking, they ought not assume there'll be a '0' in there before the x. :)

    6. Re:A better name by EvanED · · Score: 1

      The C++98 standard went from first meeting to ratified standard in under 8 years, so the'll make it.

    7. Re:A better name by emag · · Score: 1

      So 0[0-9] is greater than 98? :-)

      Seriously, I'm sure a LOT of confusion could be avoided by using C++200x. "0x" is overloaded as it is, not to mention sorting order problems, rollover issues ("was C++99 ratified in 1999 or 2099?"), etc. Add in the introduction of C#, and one can easily see how people might think it was literally referring to "C plus plus zero x".

      Ah well, it wouldn't be a standard if there wasn't widespread confusion on its correct interpretation...

      --
      "The urge to save humanity is almost always a false front for the urge to rule." --H.L. Mencken
  11. Alan by grub · · Score: 4, Funny


    What does Alan C++0x think of this?

    --
    Trolling is a art,
    1. Re:Alan by Alan+C++0x · · Score: 2, Funny

      I'll allow it
      /Mills Lane

  12. Why C didn't progress to D.. by Peter+Cooper · · Score: 2, Interesting

    Everyone knows the history of C, coming from B, which came from A. Sure, an object-oriented version of C might be C++.. but why are we progressing onto C++0x (which reads like 'cocks' to me, anyone else??)? Isn't it time for D? Or is this a marketing/branding thing?

    Either way, it doesn't look too exciting judging from these proposals. It's certainly nothing on the scale of Perl 6 compared to Perl 5, so yeah, maybe I've answered my own question. This is just a routine standards adjustment, rather than a real 'development.'

    1. Re:Why C didn't progress to D.. by Joe+Decker · · Score: 1

      Actually, B descended from BCPL, not A.

    2. Re:Why C didn't progress to D.. by vidarh · · Score: 2, Informative
      Sigh... C descended from BCPL, hence the long standing joke from before C++ of whether the next language would be called D or P. However C++0x isn't a new language, it is the working name for the next version of the C++ standard, just as previous C standards are nicknamed C89 and C99 after the language and year they were completed, and the previous version of the C++ standard is often referred to as C++98. The "0x" is meant to reflex that the new version of the standard is likely to be done sometime this decade, without tieing anyone down to a specific year.

      So the "right around the corner" in the article is perhaps a little bit optimistic - they've just barely started working on the new version.

    3. Re:Why C didn't progress to D.. by p3d0 · · Score: 1

      Sheesh. Please see this.

      --
      Patrick Doyle
      I mod down every jackass who puts his moderation policy in his sig. Oh, wait a sec....
    4. Re:Why C didn't progress to D.. by td · · Score: 4, Informative

      B didn't come from anything called A, but from a language called bon, named for Ken Thompson's wife Bonnie. (At least, that's what Ken says, but he's famous for pulling the legs of people who drool over stupid trivia from his past.) The inspiration for bon was Martin Richards' BCPL, a stripped version of Christopher Strachey's [et al] CPL (Combined Programming Language, I think; the B in BCPL is for Bootstrap or Basic, sources differ.) It doesn't stretch the truth too far to think of B as an even-more stripped down BCPL.

      --
      -Tom Duff
    5. Re:Why C didn't progress to D.. by EvanED · · Score: 1

      Why's this (*holds up a random book*) have a "second edition" in the title? Why didn't they think up a new name?

      People: THIS ISN'T A NEW LANGUAGE. It's a revision of C++98 (the current standard). Very likely there will be only a small part that changes the actual language specification itself; most of the revisions will probably be in the library.

    6. Re:Why C didn't progress to D.. by Hard_Code · · Score: 0

      D is here

      D Language

      It's a cross of C++ with some Java-ish features and some design by contract thrown in. Fine language if you ask me.

      --

      It's 10 PM. Do you know if you're un-American?
  13. C++0x? by Anonymous Coward · · Score: 5, Funny

    You mean...the successor ISN'T C#?!

    I've...I've been living a lie...

  14. Definition of the word "laconic" by Anonymous Coward · · Score: 0

    Etymology: Latin laconicus Spartan, from Greek lakOnikos; from the Spartan reputation for terseness of speech
    Date: 1589
    : using or involving the use of a minimum of words : concise to the point of seeming rude or mysterious

    "I designed and implemented the C++ programming language." --Bjarne Stroustrup

    1. Re:Definition of the word "laconic" by Anonymous Coward · · Score: 0

      Message from King of Sparta to King of Lacons: "If I come to your country I will raze it to the ground and rape your women, kill the men and enslave the children" (or something like that)

      King of Lacons Reply: "If."

  15. I think the name by Anonymous Coward · · Score: 0
    is very dirty indeed.

    It get's my vote.

  16. Re:Whatever. by Evil+Adrian · · Score: 1

    Great, you stick your old ass to plain jane ISO C, I and the rest of the world that has realized the benefits of object-oriented programming will move on to that which is superior.

    --
    evil adrian
  17. Anonymous array members by Surak · · Score: 4, Interesting

    Honestly, I don't see how this is a big improvement. You have, basically:


    struct somestruct {
    int a;
    int [3]; //3 pad bytes
    int b;
    }


    vs.


    struct somestruct {
    int a;
    int pad[3]; // 3 pad bytes, do not use
    int b;
    }


    The only thing its really saving you is the variable name, and its giving you an extra check at compile time to ensure you don't use the 'pad' array. Which shouldn't be a problem with proper variable naming and documentation, right?

    1. Re:Anonymous array members by Abcd1234 · · Score: 4, Insightful

      Okay, I'm normally not a vocal C++ basher (although I do dislike the language), but this is a really excellent example of the kind of cruft that has made it into C++. It's like everyone and their dog had some pet feature they wanted included in the standard, and the result is a huge mess of stuff that most people won't use but the compiler is forced to support.

      I suppose this is what happens when you allow a programming language to be designed by a committee...

    2. Re:Anonymous array members by Anonymous Coward · · Score: 1, Insightful

      Sorry to pick your nit, but int [3] will pad 12 bytes, not 3. an int is 4 bytes.

    3. Re:Anonymous array members by Surak · · Score: 1

      I was hoping someone would point this out. In the example, they resize the array using sizeof() which costs you *more* code. :)

    4. Re:Anonymous array members by EvanED · · Score: 1

      Well, actually, an int isn't necessarily 4 bytes. It is on 32-bit compilers, but I believe the only thing that C++98 requires is that it is at least 16 bits (there may be a maximum, but I don't think so). So it could pad 6 bytes.

    5. Re:Anonymous array members by Surak · · Score: 1

      nevermind. Ignore what I said. ints. not bytes. right.

    6. Re:Anonymous array members by Anonymous Coward · · Score: 0

      an int is 4 bytes

      Shirley, this depends on your architecture. Not all the world is IA-32.

    7. Re:Anonymous array members by orbitalia · · Score: 1

      Whats your point here? ISO C already has support for unamed bit fields in structures.

      also, int pad[3]; doesn't equate to 3 bytes, unless your C implementation defines an int as a byte which is highly unlikely its probably 4 bytes, so its 12 bytes pad in total.

    8. Re:Anonymous array members by mystran · · Score: 1

      History repeats itself. Look at Algol (and it's different versions) and you find something familiar. Then look at Java, and again you see the same problem. If you want, take a look at Common LISP standard, and you find the even if the language is good, one should never let any committee standardize it.

      --
      Software should be free as in speech, but if we also get some free beer, all the better.
    9. Re:Anonymous array members by pyrrho · · Score: 1

      ever been to a construction site? they use a lot of tools. special purpose tools, general purpose tools, backup tools if one tool breaks or isn't up to the task for some incidental reason.

      but maybe carpenters are just smarter than software engineers and can keep that all straight.

      --

      -pyrrho

    10. Re:Anonymous array members by JewFish · · Score: 0, Troll

      ADA is what happens when you let a language be designed by committee.

      C++ on the other hand is the result of years of hardwork by Dr. Stroustrup and others who happened to sit on an ISO comittee at one point.

    11. Re:Anonymous array members by Q+Who · · Score: 2, Insightful

      It's like everyone and their dog had some pet feature they wanted included in the standard, and the result is a huge mess of stuff that most people won't use but the compiler is forced to support.

      You mean like templates, and member function templates, which allow for STL? Or operator overloading and references, which allow for *real* custom types.

      Feel free to give specific examples, Mr. Insightful.

    12. Re:Anonymous array members by blancolioni · · Score: 1

      ADA is what happens when you let a language be designed by committee.


      The American Dental Association was designed by a committee?

    13. Re:Anonymous array members by Anonymous Coward · · Score: 0

      I'm amazed this comment got modded up. Show me a language that is popular that wasn't developed by a committed that isn't filled with crud.

      At a guess, I'd say you were a Java developer... becuase we all know "Java" is the perfect language. Just don't say "garbage collection" or "cross platform is only as good as the JVM (* cough cough *)", "memory hungry", "slow performance". As a Java zealot your response will be "they'll be fixed in time". Show me a Java forum and i'll show you 100 different recommendations for the next release of Java.

      No language is perfect (certainly not C++) - but they all have flaws. They are mostly developed by committees.

      AC

    14. Re:Anonymous array members by Q+Who · · Score: 1

      Depends also on the alignment...

    15. Re:Anonymous array members by i_really_dont_care · · Score: 1
      Exactly! I can see it now...


      struct somestruct {
      int a;
      int [3]; //3 pad bytes
      int b;
      }

      Line 3: Warning: Missing identifier or new-style padding. Use "--force-c-0x" to suppress this warning, or "--force-c99" to make this warning an error again.


      Seriously, how is this going to help anyone?
    16. Re:Anonymous array members by statusbar · · Score: 2, Insightful

      The problem is much worst than that.

      sizeof char is defined to be 1

      1 what? 1 char.

      A char is NOT DEFINED TO BE A BYTE (8 bits) in the any standard.

      Almost always it is, though.

      Take a look at the Texas Instruments TMS320C3x family of DSP's. It can do no byte level access. In the c compiler for it, sizeof char is 1 and defines a char as 32 bits. This means sizeof long is 1 and defines 32 bits as well. and this is completely standard compliant!!

      And it also breaks tons of code!

      --jeff++

      --
      ipv6 is my vpn
    17. Re:Anonymous array members by Anonymous Coward · · Score: 0

      "It's like everyone and their dog had some pet feature they wanted included in the standard, and the result is a huge mess of stuff that most people won't use but the compiler is forced to support."

      Are you talking about Java or C++?

    18. Re:Anonymous array members by TheAncientHacker · · Score: 1

      Nope, Fortran, COBOL and PL/I (don't laugh, they're incredible for when they were written) are what happens when you allow a programming language to be designed by a committee.

      C++0x is what you get when you allow a programming language to be "improved" by a committee

    19. Re:Anonymous array members by EvanED · · Score: 1

      That's why I was careful to say an int is at least 16 bits instead of at least 2 bytes, because I think 1 char is called a byte in the context of C++ even if it is not 8 bits.

      Quoteth the C++-FAQ Lite, section 26*:

      "Here are the rules:

      * The C++ language gives the programmer the impression that memory is laid out as a sequence of something C++ calls "bytes."
      * Each of these things that the C++ language calls a byte has at least 8 bits, but might have more than 8 bits.
      * The C++ language guarantees that a char* (char pointers) can address individual bytes.
      * The C++ language guarantees there are no bits between two bytes. This means every bit in memory is part of a byte. If you grind your way through memory via a char*, you will be able to see every bit.
      * The C++ language guarantees there are no bits that are part of two distinct bytes. This means a change to one byte will never cause a change to a different byte.
      * The C++ language gives you a way to find out how many bits are in a byte in your particular implementation: include the header , then the actual number of bits per byte will be given by the CHAR_BIT macro.

      Let's work an example to illustrate these rules. The PDP-10 has 36-bit words with no hardware facility to address anything within one of those words. That means a pointer can point only at things on a 36-bit boundary: it is not possible for a pointer to point 8 bits to the right of where some other pointer points.

      One way to abide by all the above rules is for a PDP-10 C++ compiler to define a "byte" as 36 bits. Another valid approach would be to define a "byte" as 9 bits, and simulate a char* by two words of memory: the first could point to the 36-bit word, the second could be a bit-offset within that word. In that case, the C++ compiler would need to add extra instructions when compiling code using char* pointers. For example, the code generated for *p = 'x' might read the word into a register, then use bit-masks and bit-shifts to change the appopriate 9-bit byte within that word. An int* could still be implemented as a single hardware pointer, since C++ allows sizeof(char*) != sizeof(int*).

      Using the same logic, it would also be possible to define a PDP-10 C++ "byte" as 12-bits or 18-bits. However the above technique wouldn't allow us to define a PDP-10 C++ "byte" as 8-bits, since 8*4 is 32, meaning every 4th byte we would skip 4 bits. A more complicated approach could be used for those 4 bits, e.g., by packing nine bytes (of 8-bits each) into two adjacent 36-bit words. The important point here is that memcpy() has to be able to see every bit of memory: there can't be any bits between two adjacent bytes."

      *URL: http://www.parashift.com/c++-faq-lite/intrinsic-ty pes.html

      I'd have made that a link, but then I'd need to stick BR tags after ever newline and I'm not about to do that with a post this size...

    20. Re:Anonymous array members by statusbar · · Score: 1

      Ahh, the wonders of C and C++ 'portability'!

      jeff

      --
      ipv6 is my vpn
    21. Re:Anonymous array members by Anonymous Coward · · Score: 0

      Specific example? How about anonymous arrays, which his post was referring to.

      Also, when was the last time *you* used the dynamic_cast operator, Mr. Smartypants?

    22. Re:Anonymous array members by Fnkmaster · · Score: 1

      Those aren't features of C++, they are proposed features of C++0x. If C++ were really all that bad, why would everybody use it? I mean, it's bad, but just bad enough for "worse is better" (Google the phrase, I'm not going to bother pointing you to the original articles on the topic). Sure, there are a lot of features, but basically everybody uses the sane subset thereof, and every once in a great while, if they really, really need it, they can use some of those fancy, destruct-o-matic features.

    23. Re:Anonymous array members by Anonymous Coward · · Score: 0

      Don't you mean static_cast? Without OO extensions equivalent of static_cast does fine but both dynamic_cast and reinterpret_cast are required for predictible type casts one language supports inheritance.In fact, I wonder how other languages do without them. I had used C++ without them for years but I frankly don't remember how I found my way around.

    24. Re:Anonymous array members by Anonymous+Brave+Guy · · Score: 1
      In fact, I wonder how other languages do without [dynamic casts].

      A lot of languages that don't explicitly have dynamic casts really do the same thing under the surface. There's little difference in behaviour between Java's cast via () and a dynamic_cast of a reference in C++, for example: both result in an exception being thrown if the object referred to isn't of a suitable type. I guess this isn't very surprising when you consider the similarities between how objects are handled in Java and how references work in C++.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  18. ~bs by panda · · Score: 1

    Sorry, Bjarne, but your home directory sums up what I think of this proposal.

    I mean, we're only just now getting compilers that properly handle the C++ standard from 5 years ago. Why muck things up now?

    --
    Just be sure to wear the gold uniform when you beam down -- you know what happens when you wear the red one.
    1. Re:~bs by cK-Gunslinger · · Score: 1

      Just like the linked PDF says, if a committee doesn't concentrate on C++, corporations will bend it to their will with proprietary crap and screw it up for the rest of us. Focus is a Good Thing.

    2. Re:~bs by vidarh · · Score: 1

      Because we are now getting compilers that properly handle the C++ standard, so it is finally time to start addressing more of the ideas and concerns people have.

    3. Re:~bs by ENOENT · · Score: 1

      We must destroy C++ to save C++.

      --
      That's "Mr. Soulless Automaton" to you, Bub.
    4. Re:~bs by IWannaBeAnAC · · Score: 1
      Not at all. Apart from 'export' keyword (which was, in hindsight a mistake), there have been many very high quality compilers available for quite a while now.

      Unfortunately most of them are not available for the Windows platform, but that is more a fault with the platform's manufacturer, rather than the compiler writers themselves. The DEC/Compaq compiler for Alpha is excellent, so was the KAI compiler (now subsumed by the Intel compiler, also available on Windows), and the KAI compiler existed for many platforms. The SGI compiler was lagging behind a bit but now seems to have caught up. g++ 3 is good, versions prior were a bit patchy (especially standard library issues).

      But, if you are free to choose your compiler, then almost every platform has had a high quality C++ compiler available for ages.

    5. Re:~bs by ClosedSource · · Score: 1

      "Unfortunately most of them are not available for the Windows platform, but that is more a fault with the platform's manufacturer, rather than the compiler writers themselves."

      Well, I don't think it's the "fault" of compiler writers if they decide they don't want to support a platform, but it can hardly be the fault of the company that owns the OS (unless its closed, like the XBOX).

      Is it Sun's fault that MS doesn't have a VB compiler for Solaris?

    6. Re:~bs by IWannaBeAnAC · · Score: 2, Informative
      Porting a compiler to a given platform is not just a matter of re-targetting the assembly or object format. Usually there is a ABI, supplied by the vendor, which specifies such things as calling conventions, sizes of data types, and in the Windows case, it also specifies such things as layout of virtual tables (for COM compatability) and more.

      The hard part is not in taking a compiler and getting it to construct Windows executables. The hard part is getting it to cooperate with the existing ABI well enough that you can integrate with the other compilers for the platform. This is much harder to do for Windows than it is for, say, *nix.

      In other words, if Microsoft wanted to make it easy to make 3rd party compilers for the Windows platform, then they could have done so. I am claiming that they instead did the opposite, and made it difficult to construct and maintain a 3rd party compiler. I think even Borland would agree with me on this.

      Is it Sun's fault that MS doesn't have a VB compiler for Solaris?

      No, but in this hypothetical situation, if MS had investigated making a VB compiler for Solaris but gave up because of difficulties imposed by Sun, then some of the blame must go towards Sun.

    7. Re:~bs by ZamesC · · Score: 1
      Your logic fails.....

      Nothing that changed in the standard in the latter years of standardization would have effected anything you site in your message. However, many basic features of C++ would. In other words, had MS failed to provide a complete ABI, it would be impossible to have provided any form of compiler. An ABI good enough for a non-standard compiler would be good enough for a Standard compiler.

      Beside, the Edison Design Group's compiler, (which they don't sell retail, but license to other compiler vendors), was the first fully-compliant C++ front-end --- and compiles to C code. So, all you really needed was an ABI good enough for C.

    8. Re:~bs by ClosedSource · · Score: 1

      The issue was compatability with the C++ standard, not compatability with COM. If you want to target platform-specific technologies in your C++ compiler, be prepared to compromise.

    9. Re:~bs by IWannaBeAnAC · · Score: 1
      I don't think so. Templates, for example, especially function templates, and template-template parameters, change the name-mangling scheme quite considerably. In fact, the reason why there were so many changes in the G++ ABI was because it was not possible to implement the ISO standard with the old one.

      Microsoft have other problems which affect standard compliance, for example (maybe fixed now?), in standard C++, 'class' and 'struct' are equivalent, they just have different default access specifiers. But in the MS scheme, they mangle to different names so you cannot interchange 'struct' and 'class' anymore. This is part of the ABI, its a bigger problem than just one compiler. (Sure, a vendor could fix it unilaterally, but a compatability flag would be required to get interoperability with MS headers.)

      The ABI also includes such things as how to pass 'this' to member functions, and how to represent pointers to member functions, and all sorts of things that are not in C anyway. The EDG front-end must of course produce C code which is consistent with the C++ ABI, that is (one of) the reason why the intermediate C code produced by the EDG front-end is not portable.

      And don't forget that a Windows compiler has to have the same object model that MS specifies, because that is part of the COM specification. Most other platforms don't have such constraints.

    10. Re:~bs by __past__ · · Score: 1

      Can't we perhaps just destroy C++ and maybe safe something else?

    11. Re:~bs by Anonymous Coward · · Score: 0

      What about mingw ?

    12. Re:~bs by ZamesC · · Score: 1
      Your message is almost pure nonsense.

      Name-mangling schemes are unique to the compiler vender. They have nothing to do with the ABI which would be language independant.

      I think you are confusing the operating system's ABI with the compiler's object model. The problem is that while the ABI is shared by all compiler vendors of all languages, the object model is used only by those that need static link compatibility, and is usually unique to the compiler vendor.

      The difference that while OS-vender Microsoft is required to provide an acceptable ABI in a timely fashion (which they did), compiler-vender Microsoft is under to requirement to share it's C++ object model at all. The ability to link OBJs compiled by Vendor X's C++ with OBJs compiled by Microsoft's C++ might occasionally be a nice feature to have, but it's never necessary (You just need to recompile all of your source code; if you use a third party library which was only provided as a VC OBJ without source code --- well, that was pretty foolish of you in the first place, and then doubly-foolish, in light of that, for you to switch compilers.)

    13. Re:~bs by IWannaBeAnAC · · Score: 1
      No, all of these things are part of the C++ ABI. Your comment is a bit silly, what would be the point of following an ABI if it didn't give you static linking compatability? (C++ features are not part of the C ABI of course, perhaps that is where the confusion is coming from?) The primary purpose of an ABI is to get static linking between different compilers. That must be at least partially language-dependent.

      Some examples:

      See here for some info on the common C++ ABI for g++. I think everything discussed on this thread (including vtable layout) is mentioned as part of this ABI.

      The Macintosh ABI covers: The PowerPC ABI, Structure Alignment and Bit Field Layout, Name Mangling, Class Object and V-Table Layout, RTTI, Exception Handling, Special C++ Calling Conventions

      The Sub C++ ABI covers:

      The C++ ABI includes the C ABI. In addition, it involves the following features: layout of hierarchical class objects, i.e., base classes, virtual base classes layout of pointer-to-member passing of hidden function parameters (e.g. this) how to call a virtual function vtable contents and layout location in objects of pointers to vtables finding adjustment for the this pointer finding base-class offsets calling a function via pointer-to-member managing template instances external spelling of names ("name mangling") construction and destruction of static objects throwing and catching exceptions some details of the standard library implementation-defined details typeinfo and run-time type information inline function access to members

      The name-mangling algorithm is part of the ABI, because it defines how a compiler must generate external references and definitions for program entities. If two compilers or compiler versions do not mangle equivalent declarations the same way, a program composed of parts compiled from the two compilers will not link correctly.

      Enough said?

      Of course, a vendor could choose to follow the C ABI but not the C++ ABI. That would give you the ability to at least call native C functions. But disregarding the platform ABI for any language is not something that a vendor would ever do lightly.

    14. Re:~bs by ZamesC · · Score: 1
      This seem to be just an argument over terms. What I'm calling an "compile object model", their are calling a "C++ ABI". Whatever. Either way, they have nothing to do with the OS ABI, which is what you are (wrongly) trying to tie it to.

      You'll note that your first example (G++) refers to an compiler, not an OS.

      You'll note that your third example (Sun C++) the document is published by the Sun's compiler group, not their OS division. (It's author, Steve Clamage, BTW, is (or at least, was -- he may have stepped down) also chairmain of the C++ Standardazation Committee.)

      Only in your second example (Apple) is the compile ABI specified by the OS vendor, but that's only because of Apple draconian need to control every aspect of all software that runs on MacOS.

    15. Re:~bs by IWannaBeAnAC · · Score: 1
      By "they", you really mean "the rest of the industry" :-)

      Whatever the terminology, the ABI is the spec you need to get static linking interoperability, using some language. There are obviously lots of different levels to this. At the lowest level, the hardware vendor (not even the OS writers) needs to specify, eg the alignment restrictions and floating point formats. If you are an assembly programmer and you don't need any syscalls, then this is as much as you need. Then, if you are interested in making system calls from assembly language, you need some more of the ABI, where it is specified by the OS designers how to make a system call. If you want to call C library functions, you need a bit more. And if you are using C++, you need more still. The OS-defined part of the ABI is a very minimal document though[*]. Anything beyond making syscalls from assembly language is pure user-space, and is usually determined by the compiler/library authors, not the OS authors.

      In the contexts where I have seen it used, the term "Object model" refers not so much to the low-level layout in memory, but rather to the language capabilities, eg whether it supports multiple inheritence (.NET managed environemt does not, IIRC), covariant return types, virtual base classes, etc etc. In other words, the ABI specifies the data structures that implement the object model. So, C++ has an object model, which is slightly different to that of Eiffel, which is again different to that of Smalltalk. This is important, because there are some things in the MS ABI (and the old g++ ABI, and the Sun ABI, etc etc) that mean that it is not actually possible to implement a fully ISO-conformant C++ object model. Additionally, the object model of COM is different to that of C++ (no implementation inheritance), but on the Windows platform they use the same ABI. This of course puts a lot of constraints on the C++ implementation.

      The point is though, the Microsoft ABI (as THEY define it, not me) includes such things as an object layout compatible with COM, name mangling conventions, and other things that affect the object model. eg, another long-time problem with the MS compiler is the lack of covariant return types. IIRC, this is due to problems with the ABI which MS were very slow in fixing (if indeed they are fixed yet!). I remember using the borland compiler in around 1994 I think, and it had covariant return types; presumably this was at the expense of ABI compatability - I don't recall but there was probably an option to disable it.

      The low-level parts of the ABI ("OS ABI", as you call it, although it must include some hardware-vendor supplied stuff too) is not the problem. There are, and always have been, heaps of x86 compilers that will run on a x86 windows machine (g++ and cygwin or mingwin, DOS compilers, etc). The issue is obtaining compatability with the full ABI. That is really what it means to say that a compiler targets the "Windows Platform". And my original argument still stands: I claim that it is harder to achieve this on Windows than it is for most other platforms, mostly due (directly or indirectly) to actions from Microsoft themselves.

      [*] If is a bit different on Windows, because there are quite high level interfaces to the operating system (eg, COM). Indeed, this is one of the things that makes using the MS ABI so hard.

    16. Re:~bs by IWannaBeAnAC · · Score: 1

      It is many years since I did any programming on Windows. My question would be, how well does mingw integrate with the Windows? Can you compile MFC apps with it? COM? Exceptions?

    17. Re:~bs by ZamesC · · Score: 1
      The low-level parts of the ABI ... is not the problem. ... The issue is obtaining compatability with the full ABI. That is really what it means to say that a compiler targets the "Windows Platform".

      No, that's targeting compatibility not with the "Windows Platform", but with "Microsoft VC++".

      And you are still mixing the two parts of the ABI. The COM ABI was fully described years ago, and is NOT affected by changes in C++.

      You are confusing Microsoft's responibilities as OS vendor (which it had fulfilled) with it's "responsibilities" as a compiler vendor to it's competitors (which it has none, unless someone proves MS has a monopoly on C++ compilers)

      The monopoly aspect is important. If one could prove that it is required that the OBJ produced by Compile X be link-compatibile with OBJs VC++ -- Not that it is a nice feature to have, but absolutely REQUIRED-- than MS could be forced to provide this information. Until then, MS could keep it an internal secret. And, since MS itself publishes several compilers which aren't fully link-compatible with each other (FoxPro for example), that would be very hard to prove. And my original argument still stands: I claim that it is harder to achieve this on Windows than it is for most other platforms, mostly due (directly or indirectly) to actions from Microsoft themselves.

  19. COBOL by mikeee · · Score: 5, Funny

    I'm still waiting for the object-oriented business programming language, "ADD 1 TO COBOL".

    1. Re:COBOL by Surak · · Score: 4, Interesting

      Actually, there *does* exist an Object-Oriented COBOL. (No, I'm NOT making this up!)

    2. Re:COBOL by wideBlueSkies · · Score: 1

      IBM offers an Object Oriented COBOL on MVS.

      Nobody in my shop uses it, but the current compilers support it, and the manuals are there in our Bookmanager. Been seeing this for the last 4 or 5 years.

      I don't know about features, or why you'd want to use OO in COBOL, but IBM must've had a reason to do this and contnue to provide it.

      Someone out there is using it....

      --
      Huh?
    3. Re:COBOL by Anonymous Coward · · Score: 0

      There is actually a standard for OO COBOL (COBOL 2002). The company I work for writes COBOL compilers and we actually support COBOL 2002. Now why anybody would actually want to do OO development in COBOL is beyond me, but it does exist.

    4. Re:COBOL by ros0709 · · Score: 1

      The latest COBOL standard is object orientated. Micro Focus' COBOL (and others) have had object orientation in them since the mid 90s. I was at Micro Focus whilst it was being developped: we had lots of fun deciding on names then. Apart from the ADD 1 TO COBOL example, there was also COOL (COBOL Object Orientated Languate) and - the one that stuck - Object COBOL>

    5. Re:COBOL by PetWolverine · · Score: 1

      Maybe the "OO" is like the 98 in C++98: it stands for the year of the standard. I would think, with COBOL, specifying the decade would be enough.

      --
      I found the meaning of life the other day, but I had write-only access.
    6. Re:COBOL by catscan2000 · · Score: 1

      ADD 1 TO COBOL GIVING OBJECTORIENTEDCOBOL

      For what it's worth :-)

      And for the lameness filter, this is COBOL code, not "yelling" ;-)

    7. Re:COBOL by codegen · · Score: 1

      Actually it is to fend of PHBs and consultants. Back when
      I was with a service company, several of my contacts told me of some of the letters they got from OO consultants which warned them that if they were not using the latest OO techniques, that they could be sued by thier share holders (and of course offered thier services to help with the transition). Of course much of the code is some of the most reliable code that exists in the world is beside the point.

      So using COBOL for MVS means that when the CEO calls the CIO and says "are we using an object oriented language?" the CIO can say yes with a straight face.

      --
      Atlas stands on the earth and carries the celestial sphere on his shoulders.
    8. Re:COBOL by p3d0 · · Score: 1

      Funny sig.

      --
      Patrick Doyle
      I mod down every jackass who puts his moderation policy in his sig. Oh, wait a sec....
    9. Re:COBOL by archen · · Score: 1

      Which is almost as scary as object oriented Fortran,
      which is Fortran for those who think that they couldn't be any more scarred by Fortran...

    10. Re:COBOL by Surak · · Score: 1

      Um. I can program in Fortran. Just don't tell anyone unless they're willing to pay me lots of money. :)

  20. How 'bout range checking like purify? by elwinc · · Score: 3, Interesting

    I think what C and C++ really lack is the option to turn on array range checking. Sure you can drop a couple grand for a purify license or learn to use valgrind, but it should be an easy-to-switch compiler option.

    --
    --- Often in error; never in doubt!
    1. Re:How 'bout range checking like purify? by ozzee · · Score: 1

      I think what C and C++ really lack is the option to turn on array range checking. Sure you can drop a couple grand for a purify license or learn to use valgrind, but it should be an easy-to-switch compiler option.
      This is a compiler feature and nothing to do with the language per se. There is/was a gcc project to do this; basically a purify switch on the compiler. valgrind rocks though, it's far better than purify or anything a compiler switch could do because it works with all code, instrumented or not.

      /g

    2. Re:How 'bout range checking like purify? by Homology · · Score: 1

      By using iterators and containers in STL (and www.Boost.org) you may avoid many of those pitfalls.

    3. Re:How 'bout range checking like purify? by Anonymous Coward · · Score: 0

      I don't think it should be a compiler option. Low level arrays should stay as they are without bounds checking - by ignoring bounds checking et cetera they are very fast.

      Use vectors or maybe roll your own containers - if plain low level arrays don't do what you want don't use them.

      A tidier solution is to overload the [] operator.

      I think when you call at() on vectors and other standard containers it does bounds checking. Just override [] to use at().

      This will work on all C++ compilers.

      --
      I'm hoss10 but can't remember my password!

    4. Re:How 'bout range checking like purify? by Vic+Metcalfe · · Score: 1

      Visual Studio.NET 2003 does this. I know it isn't popular with this crowd, but they have included it and it does work well with very little overhead.

    5. Re:How 'bout range checking like purify? by Vic+Metcalfe · · Score: 1

      I should add - This feature is available in the C++ that comes with Visual Studio.NET 2003, and no - I'm not talking about "managed code". I'm talking compiling to machine code and turning on a compiler switch.

    6. Re:How 'bout range checking like purify? by i7dude · · Score: 1

      hrm...my vote is for just becoming a better programmer and not relying on the language or os to make bugs go away.

      dude.

    7. Re:How 'bout range checking like purify? by stonecypher · · Score: 1

      I think what C and C++ really lack is the option to turn on array range checking.

      I wrote a range checked class in eight lines, but the Slashdot lameness filter won't let me post it. There're examples in Effective C++ (start with M18.)

      Granted it's not part of the fundamental language, but it's not hard to implement, and with some creativity it can apply to nearly every situation that can't already be covered with enums.

      --
      StoneCypher is Full of BS
    8. Re:How 'bout range checking like purify? by mystran · · Score: 2, Informative
      Uum... ElectricFence is a library that implements malloc, that check that you don't go over any bounds in dynamically allocated variables. Does a few other checks too (like double free). Link it with your project (or use LD_PRELOAD) and that's it.

      Works for C, but probably can be made to work with C++ too by writing an operator new that uses malloc() internally. Not sure if glibc actually does that.

      --
      Software should be free as in speech, but if we also get some free beer, all the better.
    9. Re:How 'bout range checking like purify? by KirkH · · Score: 1

      Check the pdf linked to in the story. It specifically mentions adding dynamic range checking to vectors and strings for C++0x. Good idea, I think.

    10. Re:How 'bout range checking like purify? by Anonymous Coward · · Score: 0
      By using iterators and containers in STL (and www.Boost.org) you may avoid many of those pitfalls.


      Exactly how does using STL avoid the pitfalls of reading out of array bounds? Sure a simple loop remains a simple loop, but the fact that end() returns a location off the end and that iterators get invalididated often means you need to to be very careful. The algorithms help, but sometimes they just aren't the tool for the job.

    11. Re:How 'bout range checking like purify? by Anonymous Coward · · Score: 0

      They already added that, the new variant is called Java.

    12. Re:How 'bout range checking like purify? by Q+Who · · Score: 1

      On SGI MIPSPro C++ compiler:

      CC -DEBUG:subscript_check=ON

      This has nothing to do with C/C++ language, it also has no value beyond debugging and protection against buffer overflow exploits.

      Each such "feature" adds several percents of time overhead (even on MIPS, where it is implemented in hardware, I guess). If you like such decisions made for you, you are better off using Java.

      By the way, C++ does provide range checking access, via at() member functions of the containers.

    13. Re:How 'bout range checking like purify? by Cthefuture · · Score: 1

      I won't reiterate what other's have posted in this thread but I'd like to add that TCC (Tiny CC) has an option for bound checking also.

      TCC also lets you interpret C code on the fly as a scripting language (ie. without compiling it). Funky stuff.

      --
      The ratio of people to cake is too big
    14. Re:How 'bout range checking like purify? by Anonymous Coward · · Score: 1, Interesting

      If you are using C++, you should be using the STL and its "vector", don't you think?

    15. Re:How 'bout range checking like purify? by HuguesT · · Score: 1

      ElectricFence uses the hardware to do bounds checking on Linux. If you want to detect both overwrites and underwrites you need to allocate two extra PAGES per malloc. This is fine for a whole host of programs, but if you happen to be using say a large priority queue with lots of mallocs you run out of resources very quickly.

      Moreover ElectricFence only check bounds for arrays allocated on the heap. For stack arrays you are stuck (ha).

      ElectricFence is not run-by-default-when-debugging solution. In many cases you need to make extra efforts to make your program run with it, at least use a small input dataset, which may not trigger the bug you are seeing. This is not the be-all and end-all of memory debugging under Linux, by a long shot.

      However it's a good tool and I use it very often. For the other cases where ElectricFence is useless, I use valgrind, and go out for a cup of tea.

  21. "two week"??!! by Fubar411 · · Score: 0, Troll

    So someone, who in no way has mastered his native language, is telling the C++ crowd how to write a language. Unbelieveable!!!

    1. Re:"two week"??!! by IceAgeComing · · Score: 0, Offtopic

      And now someone, who has mastered sticking his foot in his mouth, can go crawl back into his highly American-centered hole. Bjarne Stroustrup's native language is not English.

    2. Re:"two week"??!! by Anonymous Coward · · Score: 0

      He wasn't talking about Stroustrup, asshat. He was talking about the parent poster.

    3. Re:"two week"??!! by H.G.+Pennypacker · · Score: 1

      Unbelievable.

      --
      -- HG Pennypacker, wealthy industrialist and philanthropist
  22. Alan C++0X by sulli · · Score: 4, Funny

    This is what happens when he's happy to see you!

    --

    sulli
    RTFJ.
    1. Re:Alan C++0X by Anonymous Coward · · Score: 0

      Is that a compiler in your pants, or are you just happy to see me?

  23. Re:Whatever. by deman1985 · · Score: 1

    You have to imagine some theoretical limit to all the plusses at some point. I can just see it now...

    "What language did you write that app with?" "Oh, let's see.. That one was C plus plus, plus plus, plus plus.... plus"

  24. Re:Whatever. by Anonymous Coward · · Score: 0

    You are an idiot. Try using OO in plain C.

    It's possible, but needlessly difficult.

    C++ exists for a reason. Don't say it's shit if you haven't had time to delve into it or used it enough to form an opinion based on facts.

    The "two week IT people" are not that. More to the point, the 2 week IT people are the ones who spout comments like yours.

  25. Re:WHY DON'T THEY JUST CALL IT C++++ by cosmo7 · · Score: 1

    c += 2;

  26. Re:Whatever. by Doomdark · · Score: 1

    In case no one has ever told you, there is a very good saying "right tool for the job". C is very useful language, for (nowadays) fairly limited, albeit important, set of problems. Other C-derivatives are superior to C in many other areas.

    --
    I like paying taxes. With them I buy civilization -- Oliver Wendell Holmes
  27. learn from Java by Karma+Sucks · · Score: 3, Insightful

    I think C++ needs stuff *removed* more than it needs anything added.

    --
    (Please browse at -1 to read this comment.)
    1. Re:learn from Java by Minna+Kirai · · Score: 1

      I think C++ needs stuff *removed* more than it needs anything added.

      Funny, the Java creators are *adding* stuff they learned from C++.

      Java 1.4.1 just got templates, for instance.

    2. Re:learn from Java by Hard_Code · · Score: 2, Insightful
      Java didn't get templates. It got generics which are implemented through erasure, not code duplication.

      Unfortunately, generics tend to have a bad reputation because of the way C++ implements them. Bracha maintains that generics as they will appear in Java attempt to fix the shortcomings of C++ templates.

      Bracha pointed out that one problem with C++ templates is code bloat. For every List of type T, C++ generates a separate class. Generics as implemented by JSR-014 will not cause similar bloat: the same class and associated bytecode will work for all Lists of T.
      --

      It's 10 PM. Do you know if you're un-American?
    3. Re:learn from Java by Anonymous Coward · · Score: 0

      Is it true that generics are simply a subset of what you can do with templates?

      This new Java seems better at casting containers of derived to containers of base and vice versa - that's one thing C++ could borrow from Java.

    4. Re:learn from Java by Anonymous Coward · · Score: 0

      Well, it gives you plenty of ammo to shoot yourself in the foot with, but you have to pull the trigger.

      "Only bad programmers write bad programs..."

    5. Re:learn from Java by Coward+the+Anonymous · · Score: 1

      "Java 1.4.1 just got templates, for instance." Generics are slated for 1.5. They are not in 1.4.1 or 1.4.2.

      --
      -- Jason
    6. Re:learn from Java by YE · · Score: 1

      And, to keep learning from Java, stuff needs to be added again after a few years. (enums, generics, ...)

    7. Re:learn from Java by Cuthalion · · Score: 1

      casting containers of derived to containers of base is bad. here's why:
      class Animal {};
      class Aardwolf: public Animal {};
      class Whale : public Animal { public: void Swim();};

      vector<Whale> vWhales;
      vWhales.push_back(Aardwolf());
      // Error, Aardwolves aren't whales!

      ((vector<Animal>)(vWhales)).push_back(Aardwolf());
      // No compiler error; Aardwolves ARE animals
      vWhales.back().Swim(); // Aardwolves can't swim!!!

      --
      Trees can't go dancing
      So do them a big favor
      Pretend dancing stinks!
    8. Re:learn from Java by Unordained · · Score: 1

      if you'd -like- to just use list all over, and cast appropriately ... go ahead. as far as i can tell, it's much more efficient at run-time to already know which v-table to be using, etc. so the compiler just goes ahead and finds out. and makes sure the code is optimized for that. the fact that you can override templates with your own, type-specific versions (for storing booleans using individual bits, etc.) makes it even more fun. obviously, i could be wrong. (and yes, i'm fully expecting someone to complain about the efficiency of v-tables. go ahead.)

      the only thing that irked me recently about templates was taking code from one compiler to another ... specifically, to gcc 3.? and getting the "implicit typename" warning. i'd coded templates with gcc before, and didn't know there had been a change. got overzealous and started putting 'typename' all over the code ... even non-template stuff. then i got the other error: "spurious typename" or some such. *sigh*

    9. Re:learn from Java by Anonymous Coward · · Score: 0

      But Java will make the container read only when casting to containers of base.

  28. Vaporware? by cybermint · · Score: 2, Informative

    We got the first c++ compiler to handle the whole language just a little over a year ago. (article) I wonder how many decades it will be until we get a compliant compiler for c++r0x0rz.

    1. Re:Vaporware? by Eustace+Tilley · · Score: 1

      Sutter and Plum advocate dropping export, the reason the implementation you cite took so long, in this paper.

  29. From Merriam Webster Dictionary... by Demodian · · Score: 2, Funny

    Ox: [definition 1] a domestic bovine mammal

    Just wait until the free standard comes out: C++Gnu

    1. Re:From Merriam Webster Dictionary... by Anonymous Coward · · Score: 0

      GNU/C++ would be a much better fit, though, don't you think? I mean "new C++"

      C'mon, it wasn't that bad was it?

    2. Re:From Merriam Webster Dictionary... by BSDFreak · · Score: 1

      Yes, it was.

    3. Re:From Merriam Webster Dictionary... by Anonymous Coward · · Score: 0

      So, 0x would be a 733t oxen?

  30. Boost and STL by Homology · · Score: 2, Informative
    Note that parts of Boost library is suggested as part of the new standard :

    N1450 03-0033 A Proposal to Add General Purpose Smart Pointers

    I've used parts Boost quite alot myself (www.boost.org), and found it very useful even when using Visual Studio.

    1. Re:Boost and STL by Anonymous Coward · · Score: 0

      A Proposal to Add General Purpose Smart Pointers

      Much better than using the standard imbecile pointers.

    2. Re:Boost and STL by mcoletti · · Score: 1
      I echo that. I've been using Boost extensively for years; in fact, I'm using more of it over time. (Partly because they keep adding relevant goodies.)

      I note that a significant number of the ISO C++ committee have been activie Boost participants from day one. In fact, IIRC, they started Boost because they had ideas that didn't make it in time for the final ISO C++ ratification.

      In any case, much of Boost has been exercised and refined over the years and is very suitable for inclusion in the final specification. Better yet, most compilers won't have to change anything except header files to be compliant with such a specification change.

      --

      MAC | A polar bear is a cartesian bear after a coordinate transform.

  31. Lots of good papers there by Eustace+Tilley · · Score: 3, Interesting
    I liked this, which supports "Quality of Implementation:"

    The development cycle of embedded software does not easily lend itself to the trial-and-error style of programming and debugging, so a stubborn C++ compiler that catches as many errors as possible at compile-time significantly reduces the dependence on run-time debugging, executable run-time support and compile/download/test cycles.

    This saves untold hours at the test bench, not to mention strain on PROM sockets.


    Williams, Stephen, cited by Lois Goldthwaite in her Technical Report on C++ Performance
  32. c += 2 by Doomdark · · Score: 5, Funny
    Yeah, but that wouldn't be backwards compatible! (wouldn't compile with current compilers).

    So let's see; somebody else already proposed (c++)++ , which is a reasonable suggestion... but... um... how about "c += 2"? For now, it's as concise as the alternative, but going forward it will scale better (c += 3 vs ((c++)++)++ ).

    --
    I like paying taxes. With them I buy civilization -- Oliver Wendell Holmes
    1. Re:c += 2 by JanneM · · Score: 5, Funny

      On the other hand, maybe the ((((c++)++)++)++)... system will induce LISP-hackers to take a serious look at the language. /Janne

      --
      Trust the Computer. The Computer is your friend.
    2. Re:c += 2 by Anonymous Coward · · Score: 0

      Actually, C+=2 is a different language... its homepage is here

    3. Re:c += 2 by Anonymous Coward · · Score: 0

      We did. It still sucks.

    4. Re:c += 2 by Greyfox · · Score: 1

      Or ++c++ (though IIRC at least some compilers don't like using pre-and-post increment operators at the same time...)

      --

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

    5. Re:c += 2 by BlueWonder · · Score: 2, Informative

      The expression ++c++ is equivalent to ++(c++). Since the postfix increment operator yields an rvalue (unlike the prefix increment operator, which yields an lvalue), ++c++ is not a valid expression in C++.

    6. Re:c += 2 by ReelOddeeo · · Score: 2, Troll

      maybe the ((((c++)++)++)++)... system will induce LISP-hackers to take a serious look at the language.

      That you would say this indicates that you don't really know what Lisp is all about.

      Clue: It is not about parenthesis. It is about langauge semantics.

      Everyone gets so hung up on the surface syntax that they never see what is underneath. Very much like comparing Windows 95 to a Macintosh of the same era. Once you understand the true power of what is underneath, then the syntax has a very strong reason for being. The annoyance of using a somewhat unconventional syntax is vastly outweighed by the power it is exchanged for.

      Don't you think that any serious Lisp user would take a serious look at other languages?

      --

      Those who would give up liberty in exchange for security and DRM should switch to Microsoft Palladium!
    7. Re:c += 2 by RollingThunder · · Score: 3, Funny

      Clue: It is not about parenthesis. It is about langauge semantics.
      And that you would post that indicates that you don't really know what humor is all about.

    8. Re:c += 2 by Anonymous Coward · · Score: 0

      I think ++c++ would be better.

    9. Re:c += 2 by grazzy · · Score: 3, Funny

      he did mention he knows some basic lisp syntax, that kinda implements nohumor.h

    10. Re:c += 2 by Delphiki · · Score: 0, Redundant

      Why has nobody suggested ++c++?

      --

      Feel free to mod me "-1 - Angry Jerk".

    11. Re:c += 2 by Anonymous Coward · · Score: 0

      > The expression ++c++ is equivalent to ++(c++). Perhaps. Both result in undefined behaviour though as your altering an object twice within two sequence points.

    12. Re:c += 2 by ShadyG · · Score: 1

      Except that ((((c++)++)++)++) == c++ == c

    13. Re:c += 2 by JanneM · · Score: 1

      I humbly beg for forgiveness for having so gravely insulted this exalted language and its enlightened practicioners, the very, by them - no doubt for mystical and profound reasons - walked upon ground, that I am not worthy to even grovel pathetically in.

      I do know what Lisp is about. I know enough of it to have written some smaller apps in Common Lisp, and I like to use scheme for when there is need for a built in script language in an app. I am not fully fluent in it, but i'm not clueless either. I _like_ the syntax. I also think it is alright to poke gentle fun at something even if you like it.

      *sigh*

      Please remind me not to post anything intended to be vaguely amusing or tongue-in-cheek again.

      --
      Trust the Computer. The Computer is your friend.
    14. Re:c += 2 by r · · Score: 1

      only once the C++ committee gives in to prefix notation: (++ (++ (++ (++ c)))) :)

      --

      My other car is a cons.

    15. Re:c += 2 by __past__ · · Score: 1
      Not to mention that this syntax would only work in Scheme anyway, scince in Common Lisp the CAR of a form to be evaluated has to be a symbol or a list whose CAR is LAMBDA.

      On the other hand, (incf c 4) is probably not such a good name for a programming language either.

    16. Re:c += 2 by Doomdark · · Score: 1

      Wow. So it seems... holy guacamoley, hope I didn't infringe on anyone's trademark there! I KNEW it was too good a name not to have already been taken! :-)

      --
      I like paying taxes. With them I buy civilization -- Oliver Wendell Holmes
    17. Re:c += 2 by Dr.+Photo · · Score: 1
      (would 'I (rather (eat (make-skunk))
      (ever-again (program 'c++))))
    18. Re:c += 2 by dicka_j · · Score: 1

      As apposed to c++ programmers?

    19. Re:c += 2 by osu-neko · · Score: 1

      Obviously you've never looked through the index of CLtL2, much less read it. LISP hackers are a laugh a minute compared to humorless C-language-family hackers, at least based on the tomes they write...

      --
      "Convictions are more dangerous enemies of truth than lies."
    20. Re:c += 2 by jovlinger · · Score: 1

      but it wasn't funny...

    21. Re:c += 2 by Anonymous Coward · · Score: 0

      It wasn't funny because it's making fun of you, and you obviously have no sense of humour.

    22. Re:c += 2 by ReelOddeeo · · Score: 1

      You mean as in Bumpers. Rubber Baby Buggy.

      --

      Those who would give up liberty in exchange for security and DRM should switch to Microsoft Palladium!
    23. Re:c += 2 by Neurotensor · · Score: 1

      But I was under the impression that nothing could go faster than c ;) Except perhaps assembler but then you would have to be some kind of god to write an app in it...

  33. OOP by gregeth · · Score: 1

    I think if you are going to put the work into improving C++, do like Java and get rid of the procedural and just make it OOP only. It's just so much more functional, and why not just have newbies start out learning it that way, instead.

    1. Re:OOP by Anonymous Coward · · Score: 0

      Great.. throw out any semblance of efficent programming in the name of OOP.

    2. Re:OOP by Anonymous Coward · · Score: 0

      idiot.

      java is basically procedural C code with objects wrapped around. You want OOP only? grow a pair and check out smalltalk.

    3. Re:OOP by MagPulse · · Score: 2, Insightful

      If there's a fundamental design goal of C++, it is not to force anything on the programmer. C++ supports procedural (C), OOP (many C++ programs), interface/component-based (COM, XPCOM, and CORBA), and aspect-oriented programming (not widely used yet). It's flexible enough to allow all these and more that are to come.

      Java is a great example of a language that forces OOP on programmers. Most universities are starting students on Java because there are a lot fewer ways to get things done in the language. But experts know how to use the parts of the language that they need, and if C++0x took that power away from them they'd look elsewhere.

      Making small changes to C++ to do things like get it closer to merging with C and improve weaknesses in the library like smart pointers are worthwhile and will directly benefit programmers. I don't understand your logic that any changes have to be large and basically change the nature of the language.

    4. Re:OOP by gregeth · · Score: 1

      Well, I suppose your idea works, if say, you don't really need modular code and are perfectly happy with starting from scratch everytime you start something new. Not to mention that you're likely to have errors, etc, since you have to modify it for your current needs. Whereas in OOP, all you have to do is simply modify how you use it. It would be like being required to prove every mathematical theorem, before you can solve an equation.

    5. Re:OOP by Anonymous Coward · · Score: 0

      Haskell's more functional than either though. ;)

    6. Re:OOP by IWannaBeAnAC · · Score: 1
      Funny, I thought functional programming was rather different to OOP.

      The joke is, that you can do functional programming in C++, after a fashion, but doesn't use many of the OOP concepts to do it!

      For my work, C++ allows a programming style better than OOP: a procedural style based around generic algorithms. See, for example, Andrei Alexandrescu's book for an idea of the possibilities. This style is not available in Java because it requires templates, and last time I saw the proposals to add templates to Java, they were rather crippled anyway and wouldn't give the same functionality.

      In this style of programming, virtual functions are only used as a kind of 'single dispatch', when you must to invoke polymorphism at runtime, rather than the more robust and safer compile-time polymorphism. And I find myself wanting multiple dispatch as often as I want single dispatch, for which virtual functions don't suffice anyway.

      In other words, if all you see in C++ is a not very pure OOP language, then you have missed all of the exiting parts.

    7. Re:OOP by ThosLives · · Score: 1
      It's the age old dilemma - is OOP "better" than procedural? Is there something else "better" than both? It all boils down to a couple of things, nameley preference, ability to tolerate overhead, and reusability. Saying that OOP makes things "plug and play" is silly. I can just as easily create an object with a given interface and change the guts of how it works as call a procedural function with the same declaration but different guts in the definition. Just look at the old standard C libraries; #include is almost like including a class - you get lots of "member functions" for string manipulation but it's all procedural. One of the benefits of OOP over procedural is bundling data along with the functions, which is nice, but sometimes the overhead isn't worth it. I've been using C/C++ for something like 10 years now, and I actually *prefer* to code procedurally whenever possible.

      That said, I think the goal of C/C++, for better or worse, is to be a "you can be high level or low level as you wish", which is why it's still my favorite language.

      What I *really* want to see is a linker that will only link in the code you actually call so you don't have "dead" functions lying around in your executables! 200 kB "hello world" programs make me want to vomit! (I recall being able to do "hello world" in this in, let's see here, about 20 BYTES using MS-DOS Debug! There's coding efficiency for you!)

      --
      "There are a dozen opinions on a matter until you know the truth. Then there is only one." - CS Lewis (paraprhase)
    8. Re:OOP by Atzanteol · · Score: 3, Insightful

      Personally, I'd like to see header files go the way of the dodo. Usless, annoying, and repetitive. Why do I need to define my functions twice?

      This is one aspect of Java I appreciated most...

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

      - Charles Darwin
    9. Re:OOP by h0ss · · Score: 2, Interesting

      Yeah, it's MUCH more efficient to slog through source code to find out the definition of a function, as opposed to looking in (much more easily read) header files. I doubt I'd be able to write code anywhere near as efficiently if I had to look up function definitions within the code modules themselves.

    10. Re:OOP by Anonymous Coward · · Score: 0

      > I doubt I'd be able to write code anywhere near
      > as efficiently if I had to look up function
      > definitions within the code modules themselves.

      That's what automated documentation tools are for...

    11. Re:OOP by dackroyd · · Score: 1


      Yeah it's great not having to check where the frick a function is being defined and not being force to split information about the code between several locations however....

      You can write really efficient code with inlined functions in C/C++. This is particularly useful in the games industry where speed of execution is of critical importance.

      And yeah, yeah this where people jump on me and say that good Java compilers can make code almost as efficient C/C++, for big functions maybe but not for code constructed out of small functions that would normally get inline super-efficiently.

      --
      "Free software as in beer, copy protection as in racket" - Telsa Gwynne
    12. Re:OOP by Anonymous Coward · · Score: 0

      Maybe you should autogenerate your source files.

    13. Re:OOP by Anonymous Coward · · Score: 0

      I'd like something like pascal units with an implementation section and a interface section. The interface section is exported so it can be used by other units, and the implementation section is hidden. It all lives in the same file though.

      I've been thinking for a while that I'd love a language that was a combination of C, Java and Pascal. Handling pointers in pascal is so easy (e.g. var parameters to procedures), but in C it can be a bit confusing.

  34. Re:Whatever. by tkittel · · Score: 1

    > Um... C is C(\+)*.

    yeah, he obviously meant C(\+)+ :-)

  35. how the hell do you pronouce that by lophophore · · Score: 1

    how the hell do you pronounce C++0x?

    c plus plus zero x?

    ???

    --
    there are 3 kinds of people:
    * those who can count
    * those who can't
    1. Re:how the hell do you pronouce that by Anonymous Coward · · Score: 3, Funny

      I believe it's pronounced "double-plus ungood".

    2. Re:how the hell do you pronouce that by Blitzshlag · · Score: 1

      Correct, until the x is specified to be a number (the last digit in the year the standard is adopted).

  36. Stroustrup's Remove Embarrassments by WC+as+Kato · · Score: 1

    What does Stroustrup mean by "remove embarrassments?" I was never embarrassed to admit programming in C. As a matter of fact, back in the day (circa 1988) it was cool to tell people I programmed in K&R C. (This is Kernighan and Ritchie pre-ANSI C for you young'ens.)

    --
    --- I'm Green Hornet's sidekick not Inspector Clouseau's!
    1. Re:Stroustrup's Remove Embarrassments by Eustace+Tilley · · Score: 2, Funny

      C has 15 levels of operator precedence, and you do not blush?

    2. Re:Stroustrup's Remove Embarrassments by Anonymous Coward · · Score: 0

      back in the day (circa 1988) it was cool to tell people I programmed in K&R C

      Yeah, that was my pick-up line at the singles' bars.

      "Hey, baby. I program in K&R C."
      "Ooooh, take me now, stud man!"

    3. Re:Stroustrup's Remove Embarrassments by EvanED · · Score: 1

      Stroustrup considers many of the "features" of especially K&R C to be embarassing, like the implicit int, non type-checked functions, etc.

    4. Re:Stroustrup's Remove Embarrassments by frane · · Score: 1

      One specific embarrassment to remove is given on page 8 of the linked pdf:

      vector<list<int>>

      Compilers choke on that, assuming that the >> at the end is the operator >>, not closing the template declaration. To make it work correctly you have to say > > (with a space in between). That makes it look odd:
      vector<list<int> >

    5. Re:Stroustrup's Remove Embarrassments by Dan+Ost · · Score: 1

      What are you talking about? In practical programming,
      there are only 3 levels:
      1. (), [], and ->
      2. *, /, and %
      3. + and -
      and you put parentheses around everything else.
      Putting parentheses around something you would
      otherwise have to look up is good practice because
      it means you don't have to look it up later when
      trying to maintain the code.

      --

      *sigh* back to work...
    6. Re:Stroustrup's Remove Embarrassments by devnull17 · · Score: 1

      What are you talking about? You're forgetting 90% of C's operators, from the increment and decrement operators to the sizeof operator to bitwise math and shifts to boolean logic to casts to assignment to the comma.

    7. Re:Stroustrup's Remove Embarrassments by Dan+Ost · · Score: 1

      That other 90% falls into the "put parentheses around everything else" catagory.

      However, your mentioning of the increment and decrement operators reminds me:
      the increment and decrement operators are generally best used by themselves,
      not in complicated expressions where precedence order might be confusing.
      This is not because the precedence order might cause confusion, but because
      these operators might go unnoticed during casual inspection if they aren't
      set apart in the code.

      --

      *sigh* back to work...
    8. Re:Stroustrup's Remove Embarrassments by Eustace+Tilley · · Score: 1
      What do you recommend a C compiler do, then, when it comes across "everything else"? Reject the code if every token is not parenthesized? Or should it have an unambiguous rule? It must do something when it sees
      while (*e++=*p++)
      Other languages scrape by somehow with four levels.
    9. Re:Stroustrup's Remove Embarrassments by devnull17 · · Score: 1

      That other 90% falls into the "put parentheses around everything else" catagory.

      That all depends on where you draw that line of distinction. The fact that most people (myself included) do not know the order of precedence and favor "cheating" using parentheses over actually learning the order speaks volumes about the difficulty of it.

      What does increment operator "good practice" have to do with the complexity of operator precedence? The fact that it's there and can be used all over the place means that people will use it, which in turn means other people have to read it and understand it.

      It's possible to write a fairly straightforward C++ program. The problem is that the language is so munged and complex that virtually no one bothers doing so.

    10. Re:Stroustrup's Remove Embarrassments by Anonymous Coward · · Score: 0

      Other languages scrape by somehow with four levels.

      Sure. By eliminating pointers. Or not providing bit-level operations. Or having no increment/decrement operator. Or...

    11. Re:Stroustrup's Remove Embarrassments by Eustace+Tilley · · Score: 1
      Or ... prefix (Polish, Lukasiewicz) notation lets you have pointers, bit-level & increment/decrement operators, and exactly one precedence level ("left to right").

      Are you saying you like
      *pc++=*pa++**pb++
      better than
      assign deref postincr c mult deref postincr a deref postincr b
  37. Compiler Compliance by wideBlueSkies · · Score: 3, Interesting

    I haven't read all the proposals, hence my early post, but the subjects look interesting. It'll be cool to see what makes it to the final standard.

    But that's not why I'm posting.

    It's nice to read about all the standards processes, and I can appreciate all the great work that these bodies perform. But after the standards are completed, and everyone goes home, it seems to take years for the compiler writers to implement the standards properly.

    I'm not trying to slam the poor developers who have to implement the changes. But yet, it seems that the standards bodies don't seem to take acutual usage of the last set of changes into account before proposing the next set of standards.

    What I mean is this: Take C++ 97. OK? How many of us have actually used a 100% compliant compiler, and used the latest features? Not too many. I know I haven't. But it seems to me that the language masters want to go ahead and move C++ along without getting real feedback from developers about how useful the language changes are.

    It's almost like the big boys are saying "well, it'd be nice to have X, Y, and Z in the language" instead of "you know, everybody hates the way we did A, B, and C back in 97. Lets think about fixing that". The language masters, IMHO are basing the next round of changes on their experiences, not the experiences of the developer community at large.

    C++ is already a big complicated language. Maybe the standards process should slow down a bit and give us ordinary developers a few more years to catch up.

    --
    Huh?
    1. Re:Compiler Compliance by be-fan · · Score: 1

      The currently available compilers have all caught up. Visual C++ 7.1, Intel C++ 7.1, GCC 3.2.x, and Comeau are all throughly standards complient. The only known missing feature for most compilers is export, and export is DOA to begin with. By the time the next standard comes out (not for more than a year, at least) most of the kinks with the current batch of compilers should be worked out. I've been using advanced C++ features (Boost, template metaprogramming, etc) for a while now, and I've yet to hit any major compiler bugs in ICC7 or GCC 3.x.

      --
      A deep unwavering belief is a sure sign you're missing something...
    2. Re:Compiler Compliance by ozzee · · Score: 1

      I don't have much to add other than I heartiy agree.

      I am concerned that much of the STL is not ideal for real-life applications and I think we might see more of the same with 0x. I certainly have issues with some of the proposals for additions to the STL.

      I consider myself an expert on C++ and I have not yet settled on a stable set of techniques as I had done with C. It seems that many people have their sights set that C++ as a better C and in doing so they short change their opportunities with C++ dramatically. This is reflected in some of the STL.

      So I adocate strongly for a "slow down" approach and let's see what people really want.

    3. Re:Compiler Compliance by EvanED · · Score: 1

      >>How many of us have actually used a 100% compliant compiler, and used the latest features?

      I haven't, but I've had a couple libraries that use partial template specialization and had to work around the lack of support.

      >>But it seems to me that the language masters want to go ahead and move C++ along without getting real feedback from developers about how useful the language changes are.

      Many "real developers" are on the committees; they aren't just some people sitting around in a high-white tower.

      >>Maybe the standards process should slow down a bit and give us ordinary developers a few more years to catch up.

      See, that's the problem... it'll take a few years to finish the draft and have it ratified. In the meantime, there are things that are currently missing from the language (e.g. threading support, which may be added this time) that have an ever-increasing amount of non-standard solutions that make it that much more difficult to learn 'cause now you have to learn 5 different libraries instead of one.

      (BTW: I use "language" above to refer to both the language and its libraries; for instance, threading will probably be added as a library feature, not as an explicit language feature as in Java or C#.)

    4. Re:Compiler Compliance by mstorer3772 · · Score: 1

      Err... huh?

      I use STL in "real-life applications" on a regular basis. Maps, sets, vectors, deques, lists, algorithms, auto_ptr (and boost's shared_ptr), and so on. I haven't needed iterator adapters (for example) but that doesn't mean their not useful in "real-life applications".

      Would you care to back up your assertion with some examples?

      --
      Fooz Meister
    5. Re:Compiler Compliance by stonecypher · · Score: 1

      I haven't read all the proposals

      We know.

      But yet, it seems that the standards bodies don't seem to take acutual usage of the last set of changes into account before proposing the next set of standards.

      Once you read that talk, you'll see that that's the topic of one of the seven major sections of the talk. Specifically, how to avoid the subtle behavior changes colliding with existing code, and the debacle that inconsistent support has created in the past. In fact, the apparent reason that there's been so little aggressive development in 97-01 was to allow a lull for stability and compliance to catch up.

      So be sure to read what people are saying before you complain about what they never talk about, mmkay?

      --
      StoneCypher is Full of BS
    6. Re:Compiler Compliance by jdennett · · Score: 2, Informative

      You'll be glad to know that the committee is aware of these issues and gives them more weight than you might believe. C++ doesn't evolve quickly; changes made in the last 6 years are nothing more than fixing defects, and the next standard is probably close to 6 years away.

      The committee is generally not interested in adding features for the sake of adding features. New proposals are expected to fix a documented problem, and to show that they are valuable enough to justify the lack of stability they cause.

      There is also clear recognition among the committee that C++98 was too inventive, and that anything significant that goes into C++0x should do so only after real-world experience with it has been obtained and reviewed. Hence the intention to publish a "technical report" on new library features -- it is likely that this TR will form the basis of much that will end up in C++0x, but its initial publication will not be in the form of an official standard.

    7. Re:Compiler Compliance by ray-auch · · Score: 1

      VC++ does partial template specialization now (I didn't think it did yet) ??

      If that's true I need to upgrade - been cursing that particular missing bit for a long time...

    8. Re:Compiler Compliance by Anonymous Coward · · Score: 0

      >>We know
      >>mmkay

      You're probably right about the parent, but these barbs make you sound like a snotty little asshole.

    9. Re:Compiler Compliance by stonecypher · · Score: 1

      You're probably right about the parent, but these barbs make you sound like a snotty little asshole.

      That's astonishingly self referential. Good thing you're an AC.

      BTW, it's intentional. I get annoyed when people complain about things that a page of reading would have stifled. It's a waste of bandwidth and a raising of S/N (which in turn is just another waste of bandwidth.)

      --
      StoneCypher is Full of BS
    10. Re:Compiler Compliance by ZamesC · · Score: 1
      I should point out that there was never a point when "the standards are completed, and everyone goes home".

      After the first Standard was approved in 1998, the committee merely cut down from three meetings a year to two per year.

    11. Re:Compiler Compliance by Q+Who · · Score: 1

      The only known missing feature for most compilers is export, and export is DOA to begin with.

      Try writing some code that uses locales... GCC is also a joke when it comes to complex code using templates, such as boost's. It just ICE's, or fails to link, or both. (And what I am gonna do, send my whole project as a bug report?)

      GCC 3.3 is simply ridiculous, I don't know what things they did better, but it just wrote LOTS of "failed to inline" warnings on the code that even GCC 3.2.3 compiled, and ICE'd at link phase.

      I am now working with ICC 7.1.006, it's like a charm, although it got some problems too (overloading delete with size_t parameter, inheritance from templated classes), but nothing like GCC.

      In short, not everything is nice in the C++ land when you try to actively use the new language features.

    12. Re:Compiler Compliance by Q+Who · · Score: 1

      Would you care to back up your assertion with some examples?

      Who needs examples when you have a rock-solid opinion of an expert on C++?

      I mean, who knows, it could be Great Master Alexandrescu himself whom you challenge so foolishly. Or, Bjarne Stroustrup! (shhhh.....)

    13. Re:Compiler Compliance by Anonymous Coward · · Score: 0

      You're still a snotty little asshole mmkay?

    14. Re:Compiler Compliance by ozzee · · Score: 1
      Would you care to back up your assertion with some examples?

      Sure, create an object that "knows" how to remove itself from a list and a map. See how many separate object you end up creating simply becase the STL model is too restrictive.

    15. Re:Compiler Compliance by be-fan · · Score: 1

      If you know C++ very well, that might be the problem. The STL is a very different paradigm from C or traditional C++ style code. The big thing is that they are very value oriented, in comparison to previous C/C++ containers, which are very object-oriented. I think this is a major hangup for people coming from more traditional techniques. However, STL containers aren't all that different from containers in other languages. I use Python a lot, and the STL seems like a C++ version of Python lists and dictionaries.

      I personally started out using the STL on a fairly complicated one person project. Until then, I had no previous experience with the STL. When I started coding, I just did things the way the STL made me, and I found that it worked *great*. The final program had very few bugs, and even though I was doing tons of data structure management, I didn't use new/delete a single time. It did, however, require a very big change from how I had previously programmed.

      --
      A deep unwavering belief is a sure sign you're missing something...
    16. Re:Compiler Compliance by be-fan · · Score: 1

      struct foo
      {
      foo(list<foo>& c)
      :container(&c){}

      ... define comparison operator...

      void remove()
      {
      list<foo>::iterator i;
      i = find(container->begin(), container-
      >end(), *this);
      container->erase(i);
      }

      list<foo>* container;
      };

      The bigger question is, why do you want to do this? I've used the STL a lot, and I have yet to hit a case where an object needed to remove itself from a list. Could you give me an example?

      --
      A deep unwavering belief is a sure sign you're missing something...
    17. Re:Compiler Compliance by ozzee · · Score: 1

      Ok ... that is constant time that is. Your example blows when there are a millions of objects on the list. (actually when there are only thousands).

      I've used the STL a lot, and I have yet to hit a case where an object needed to remove itself from a list. Could you give me an example?

      Because in OO land, an object should manage itself including knowing when to remove itself.

      If you have yet to come across this problem, you're probably not thinking in an OO way.

      Sure, here is an example, a streaming server has a class used to manage a client connection. There is a list of such client connections per stream and each client gets a "copy" of the message to be sent next. A client may terminate the connection at any time or there may be other conditions that will teminate a client connection. So each client object needs to know how to remove itself from the list of clients. When you get down and deep, there are far more examples. Streaming servers can handle 10,000 clients and connections come and go at 100's or more per second on peak loads. It just does not make sense to make this more expensive by having to do a linear seach.

    18. Re:Compiler Compliance by ozzee · · Score: 1
      When I started coding, I just did things the way the STL made me, and I found that it worked *great*.

      How do you handle polymorphism if you only use STL containers ?

    19. Re:Compiler Compliance by NMSpaz · · Score: 1

      It's true-- VC++ 7.1 is a HUGE leap from 7.0, much, much bigger than from 6.0 to 7.0. The only reason it doesn't get a major version bump is because the rest of the .net crapola hasn't moved along at the same pace.

    20. Re:Compiler Compliance by be-fan · · Score: 1

      I didn't need polymorphism for this particular project. But if you want OOP with STL containers, just use boost::shared_ptr (soon to be standard C++ smart pointers).

      --
      A deep unwavering belief is a sure sign you're missing something...
    21. Re:Compiler Compliance by ozzee · · Score: 1
      But if you want OOP with STL containers, just use boost::shared_ptr (soon to be standard C++ smart pointers).

      If shared_ptr had a few more things I'd be happy about this. As it stands I think this is a big mistake for 0x.

    22. Re:Compiler Compliance by be-fan · · Score: 1

      What's missing?

      --
      A deep unwavering belief is a sure sign you're missing something...
    23. Re:Compiler Compliance by ozzee · · Score: 1
      What's missing?

      An efficient way to support objects like COM.

    24. Re:Compiler Compliance by ozzee · · Score: 1

      OK, things have changed. This code did not compile with earlier compilers. Hmm, I still would like to it to be different but this may be ok for how I do things. Hmm, may it was multimaps that I was having trouble with ...

      Anyway, I eat my words.

      #include <algorithm>
      #include <list>
      #include <iostream>

      using namespace std;

      struct foo
      {
      foo(list<foo>& c)
      : container(&c)
      {
      cout << "making " << (int)(this) << endl;
      }

      foo( const foo & other )
      : container( other.container )
      {
      cout << "making " << (int)(this) << endl;
      }

      bool operator <( const foo & rhs)
      {
      return this < & rhs;
      }

      bool operator ==( const foo & rhs)
      {
      return this == & rhs;
      }

      void remove()
      {
      container->erase(i);
      }

      ~foo()
      {
      cout << "killing " << (int)(this) << endl;
      }

      list<foo>* container;
      list<foo>::iterator i;
      };

      int main()
      {
      list<foo> container;

      container.push_front( container );
      ( * container.begin() ).i = container.begin();

      container.push_front( container );
      ( * container.begin() ).i = container.begin();

      list<foo>::iterator x = container.begin();

      container.push_front( container );
      ( * container.begin() ).i = container.begin();

      x->remove();
      }

    25. Re:Compiler Compliance by be-fan · · Score: 1

      What is COM? COM isn't part of standard C++, and anything related to it has no business being in the standard library. Facetious c.l.c++ answer aside, Boost's smart pointers do what you want. Take a look at the intrusive_ptr template.

      --
      A deep unwavering belief is a sure sign you're missing something...
    26. Re:Compiler Compliance by ozzee · · Score: 1
      ... Boost's smart pointers do what you want. Take a look at the intrusive_ptr template.

      Would not this mean that every time you pass one of these things you will need to increment and decrement the reference count and possibly multple times ? No thanks.

    27. Re:Compiler Compliance by be-fan · · Score: 1

      Pray-tell, how do you plan to achieve reference counting semantics if you don't want to increment/decrement the reference count? Please don't tell me you hand off COM pointers without calling AddRef/Release! If COM makes reference count increment/decrement expensive, that it's problem, and the standard library should try to make workarounds for it.

      --
      A deep unwavering belief is a sure sign you're missing something...
    28. Re:Compiler Compliance by ozzee · · Score: 1
      Pray-tell ?

      I thought there was a law between separation of religion and programming ?

      Yep, there is a neat way to do this. There is a discussion on comp.std.c++ that is discussing this now. It may have some holes but for the performance hungry, this may be the correct way to do this.

  38. Wrong name by p3d0 · · Score: 0

    That name would corrspond to "C+1". "C++" corresponds to "ADD 1 TO COBOL GIVING COBOL".

    --
    Patrick Doyle
    I mod down every jackass who puts his moderation policy in his sig. Oh, wait a sec....
    1. Re:Wrong name by ros0709 · · Score: 1

      No it doesn't.

      ADD 1 TO COBOL is equivalent to ADD 1 TO COBOL GIVING COBOL. In general, the format is ADD value TO source GIVING destination, but if the GIVING clause is omitted, destination is the same as source.

      Alternatively, you can write

      COMPUTE COBOL = COBOL + 1.

    2. Re:Wrong name by p3d0 · · Score: 1

      Sorry, my mistake.

      --
      Patrick Doyle
      I mod down every jackass who puts his moderation policy in his sig. Oh, wait a sec....
  39. C+=2 by Anonymous Coward · · Score: 0

    Actually, a continuation of the patern C, C++ is C+=2. Perhaps that was already taken. Does C++0x rhyme with detox?

  40. SCO by ikewillis · · Score: 4, Interesting
    Watch out, SCO thinks it owns C++:

    MozillaQuest Magazine: C++ appears to be one of the properties that SCO acquired through Novell's acquisition of AT&T's UNIX Systems Laboratories and subsequent purchase of Novell's UNIX interests by SCO. At this time most Linux and/or GNU/Linux distributions include C++ compilers and editors. Is this something for which SCO currently charges? If so, just what are the current arrangements? If not, will C++ licensing and enforcement be added to SCO's licensing and enforcement program?

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

    MozillaQuest Magazine: How about GNU C++? Does GNU C++ use SCO IP? If so, could SCO license and/or charge for use of its IP in GNU C++?

    Blake Stowell: I honestly don't know.

    1. Re:SCO by Q+Who · · Score: 2, Informative

      That's about Cfront, not ANSI C++ Standard. But I am sure you knew that, and are just karma-whoring.

    2. Re:SCO by Anonymous Coward · · Score: 0

      [ SCO thinks it owns C++ ... ]

      Well, switch to an honest-to-God IBM developed
      language, then: Fortran.

      Toon Moene.

    3. Re:SCO by Anonymous Coward · · Score: 0

      Worf: "The Romulans claim everything that is in their field of view."

  41. In other news... by PetWolverine · · Score: 1

    Reports show that the reason for the groups lengthy debates was the argument over the syntax of the programming language's name itself.

    --
    I found the meaning of life the other day, but I had write-only access.
  42. Re:Fake? by nadim · · Score: 1

    Oops broken link, try this:

    http://groups.google.com/groups?selm=EK8Ea.1338% 24 qd3.1247%40tornadotest1.news.pas.earthlink.net&oe= UTF-8&output=gplain

  43. Re:Whatever. by mr_e_cat · · Score: 1

    With the C++Ox or thay are just adding more gobbledegook. Take this from the link:

    Controling Implicit Template Instantiation


    Piling abstraction on abstraction. The language is more complex than the logic it is trying to implement.

  44. Is it time to remove features? by Anonymous Coward · · Score: 0
    One big problem with C++ is that it is not an orthogonal language. There are too many misfeatures and so many different ways to abuse the language.

    Could C++ be tightened up? Why not tackle that age old bugaboo the "dangling else". Why not take this opportunity to require curly braces around all if/else constructs? There are many small fixes like this which would make C++ a tighter, more robust language.

  45. If C++ source is .CPP... by Anonymous Coward · · Score: 1, Funny

    (This is a joke, for the sarcasm impaired.)

    Then will C++0x be .CPP0X? Sounds like "Seep Pox", a new virus caused by inadequate plumbing infrastructure.

    Buffer overflow exploits, anybody?

    <sig>Mr. Kaze</sig>

    1. Re:If C++ source is .CPP... by da2 · · Score: 1

      it could be .C0X which has other implications

  46. More on D by Randolpho · · Score: 4, Insightful

    I know talking about D is already redundant on this article, but I'd like to anyway. Improving c++ is great, but where c++ *really* needs improvements is the syntax. It's time for c++ to move into the 90s and get rid of the preprocessor. It's unnecessary with modern compilers, and it's a pain in the ass.

    One of the stated goals on the .pdf file linked is to make c++ easier to learn, but many of the syntactic kludges in c++ (like the preprocessor and the differences between a pointer and a reference) confuse the hell out of newbies. It's time to adopt a syntax more like Java while retaining the power of native compilation and library creation that c++ gives.

    In short, it really *is* time to move to D.

    --
    "Times have not become more violent. They have just become more televised."
    -Marilyn Manson
    1. Re:More on D by Homology · · Score: 2, Insightful

      If you remove the preprocessor, you'll wont be able to compile a _great_ many programs without great many changes. C++ has it's root's in C, and it show by it supporting some pretty obscure C constructs. Another use of the preprocessor, that I'm sure you use (unless you're using VC with #pragma once) is somthing like #ifndef __SOMEHEADERFILE_H__ #define __SOMEHEADERFILE_H__ ....... #endif

    2. Re:More on D by gbjbaanb · · Score: 2, Insightful

      why get rid of the preprocessor? every C++ programmer finds it useful, and if the argument is that you can create obscure and unmaintainable code with it - well, you don't need the preprocessor to do that!

      Yeah, we need a java-like syntax so you too can create lots of debug info in programs with 'if (global_debug==1) ' rather than the infinitely more efficient #ifdef DEBUG.

      I think some people have problems with practical features of the language - sure, we can make it 'elegant' (like they read somewhere that java was), ignoring the fact that people use the language to get the job done. If you want to make C++ easier - stop using it! Go get yourself a copy of Visual Basic if you don't want the features C++ offers. You *do* want those features, then learn it, just like all the other C++ programmers have done before you. Too bad that the newbies have to, *gasp* understand what they have to do to make the code work, that they can't just knock up a program in a half-hour without any thought involved. Possibly this is one of the best features of C++ - you can't have any old monkey programming it, not without being found out straight away.

    3. Re:More on D by Anonymous Coward · · Score: 1, Insightful

      I disagree a bout getting rid of the pre-processor, in a lot of cross platform software it is very necessary. Even between Unixes there are subtle differences in the way some system functions work that mean the code has to be slightly different on each platform. The #ifdef thing is VERY useful for this. Those people who have applications that do not use the preprocessor do not need to use it.

    4. Re:More on D by HeghmoH · · Score: 2, Insightful

      Yeah, we need a java-like syntax so you too can create lots of debug info in programs with 'if (global_debug==1) ' rather than the infinitely more efficient #ifdef DEBUG.

      I'm pretty sure Java guarantees that if the conditional of an if is known at compile-time (as it would be in this case), then the if will be optimized out of your code. Just like an #ifdef. So, nice straw-man, but the two constructs are equally efficient.

      --
      Mod down posts with a "Free Mac Mini/iPod" sig, they're spam!
    5. Re:More on D by Webmonger · · Score: 1

      Herb Sutter's response is that you shouldn't be sprinkling #ifdefs throughout your program. Instead, you should do something like this:

      ---debug/tools.h---
      typedef DebugMemAllocator MemAllocator;

      void func1();

      void func1()
      { ///Lots of debugging code here
      }


      ---standard/tools.h---
      typedef StandardMemAllocator MemAllocator;
      inline void func1()
      {;}//does nothing


      You would then use an -I compiler directive to use the appropriate header for your build. Sutter used the example of multi-platform builds, and the technique applies even better there.

      Note that DebugMemAllocator and StandardMemAllocator do not have to be defined in tools.h

    6. Re:More on D by Coward+the+Anonymous · · Score: 1
      "I'm pretty sure Java guarantees that if the conditional of an if is known at compile-time (as it would be in this case), then the if will be optimized out of your code. Just like an #ifdef. So, nice straw-man, but the two constructs are equally efficient."

      The java compilier does do this optimization.

      However, a preprocessor in Java would still be nice because of platform changes.

      For example, we have some classes that implement the java.sql.PreparedStatement interface. In 1.4, they added extra methods. When we compile in 1.3, everything is fine, but building with a 1.4 copilier like I have at home will not build. So I had to add and implement those methods to build on JDK1.4. So when I work at home I have to uncomment these line to build. But when I compile at work I have to comment them back out b/c their implementation calls the same function on the super class which, of course, doesn't implement these methods in 1.3.

      I can't use an
      if(jdk14)
      block b/c Java still tries to evaluate the contents of the if block even if it is going to be optimized out.
      --
      -- Jason
    7. Re:More on D by jandrese · · Score: 1

      Maybe it's just me, but that looks like a wonderfully bad idea. It looks like a lot of work keeping the two versions in sync considering most people use DEBUG directives to stick a printf or cout and possibly some calculations in the code at a critical point to monitor what's going on. You're either going to need a whole bunch of those func1()s or they're going to have to be very very generic (basically just print statements). I'm also not a fan of messing with the -I line to change your debugging mode, since the -I and -L lines are the most troublesome parts of the Make file when you're getting someone elses code (and you have to figure out where their system put stuff, and what it called it). You never know what some system is going to stick in some wacky location.

      --

      I read the internet for the articles.
    8. Re:More on D by jmauro · · Score: 1

      Or you could go back to the implemented version of java.sql.PreparedStatement and implement the new methods. It would allow the system to compile and wouldn't hurt jdk1.3. It would just ignore them. By not implementing them and even trying to run them on a 1.4 system you'll run the risk of not having them around when a system SQL process tries to use the interface.

    9. Re:More on D by Anonymous Coward · · Score: 0

      D exists and is implemented here.

    10. Re:More on D by jdennett · · Score: 1

      D looks interesting, it's true, but last time I read through it's list of "improvements" they were largely actually a list of "things where D doesn't have the same goal as C++". Interestingly some of the reasons _for_ doing things a particular way are the same reasons for _not_ doing it that way in C++.

      C++ doesn't have to do everything. Serious C++ users know and use other languages when it's appropriate (which is often), or combine C++ with other languages (Perl, Python, Tcl, C, ...).

      And the difference between pointers and references in C++ are a lot more than syntactic.

      Note that languages which don't come with a preprocessor usually get preprocessors bolted on, either in their evolution or as third-party extras. The C++ preprocessor is ugly, it's true, by inheriting from the C preprocessor, but there is a need for some kind of preprocessor. C++ just covers more uses than a language like Java.

    11. Re:More on D by fitten · · Score: 2, Informative

      Yeah, we need a java-like syntax so you too can create lots of debug info in programs with 'if (global_debug==1) ' rather than the infinitely more efficient #ifdef DEBUG.

      Except that with the former, you can debug any time you need to, without using/loading a new (and different) executable. In addition, if you do it right, you can turn debugging on/off in a system without shutting it down (a feature that can be invaluable at times).

      Using #ifdef DEBUG, you, by definition, change the executable, which can change the properties of the execution of the code (things like timing). Ever had a program that worked in debug mode but not -O2 mode? Ever put a printf() into the code that caused it to work but not having it there caused the program to crash? (not talking about using variables before a value is assigned or stack corruption)

      Granted, #ifdef DEBUG can remove code that has cache destroying calls/code in it. However, just because #ifdef DEBUG can be more efficient does not mean that it is always the best approach to the problem.

    12. Re:More on D by stonecypher · · Score: 1

      It's time for c++ to move into the 90s and get rid of the preprocessor.

      I said that right up until I really learned some of the disgustingly funquadelic stuff you can do with the preprocessor. The problem isn't so much that the facility is there as it is that it's used as an excuse not to introduce useful features into the compiler. #pragma is the same way; how many times have you seen ifdef guards and pragma once, and longed for PHP's include_once() and require_once() ?

      That said, just wait until you have a reason to want to embed binary data as ascii into source code without external tools doing some magic hokery parsing for you behind the scenes. The preprocessor is used to create pre-magic magic that makes source that a human should never have to type out or understand. When you do embedded programming without a giant toolchain (that is, pretty much any time you use GCC for reasons other than money or linux activism) you find that macros are a wonderful tool.

      I'm with you: burn all #define foo 10 in favor of enums or a real language feature. get rid of ifdef guards. But don't nuke a useful tool.

      --
      StoneCypher is Full of BS
    13. Re:More on D by Q+Who · · Score: 2, Insightful

      It's time for c++ to move into the 90s and get rid of the preprocessor. It's unnecessary with modern compilers, and it's a pain in the ass.

      Why do I have a feeling that you never really used a preprocessor when you do claims like that? Preprocessor is most useful feature, see for example enforcer idiom by Alexandrescu and Marginean, even if it's just for __LINE__ and __FILE__.

      My only complaint for C++ preprocessor is that it's actually C preprocessor, not C++ (performed at the stage before C++ parsing), and is not flexible enough (postponing conditional compilation until macro expansion would be nice).

      There should be a rule... Everyone complaining about C++ should know it. Complain about overloading functions, be ready to cite Chapter 13 of ANSI/ISO C++98... It would really reduce S/N.

    14. Re:More on D by etymxris · · Score: 2, Informative

      Well, there are people who don't like the preprocessor and have been coding for quite a while. I've been coding C++ for 7 years and as time goes on I like the preprocessor less and less. The main reason is that it is an obstacle to tools that help development. One common example is the debugger--not even Microsoft's Visual C++ could render macros transparent.

      Another problem is tools that do automatic code-folding have a much more difficult job with macros. I was using jGRASP because it does a great job of code-folding. The only problem is that it couldn't handle macros. So a macro that expands with a semi-colon to make a complete statement would be seen instead as the first token of the next statement. Now you may fault the programmer for not figuring out how to do code-folding with macros, but I believe the difficulty is inherent in the language itself. In order to handle macros properly, it would have to have a built-in preprocessor.

      The third problem is code I'm reading or writing. It is often infuriating to try to figure out syntax problems that involve macros. The macros are supposed to make things easier, but instead they just make them opaque. One of the worst offenders is MFC, with macros like IMPLEMENT_DYNAMIC and AFX_*.

      It seems problematic that to figure out the proper syntax of the language a preprocessor must be run first. The existence of the preprocessor has many advantages, but it has many detriments too. It invites API programmers to create macro-shortcuts that hide the syntax. These attempts at abstraction introduce all the problems of abstract languages (opaque-ness) while avoiding all the benefits of abstract syntax (safety, simplicity).

    15. Re:More on D by Anonymous Coward · · Score: 1, Insightful

      in a lot of cross platform software it is very necessary

      Damn right, give me an example how you would replace code like this:

      #ifdef WIN32
      typedef unsigned u32;
      #endif
      #ifdef MSDOG
      typedef unsigned long u32;
      #endif

      The thing is that the pre-processor can conditionally compile stuff that's not actual code. Especially when writting portable code it's required to conditionally select a header file. You can't replace that with

      if( platform ==WIN32 )
      typedef unsigned u32;

    16. Re:More on D by Webmonger · · Score: 1

      In our code, there are very few debug conditionals (fewer than 20 of 131438 lines of code).
      We just use debugpf()-- in debug mode, that's another name for fprintf(STDERR, ...), and in release builds, that's a noop.

      Typdedefs and templates can probably pinch-hit for macros for debugging purposes, but it could be ugly.

      And there are some things (especially with predefined macros like __LINE__ ) that only macros can achieve.

      I'm just saying the debugging doesn't automatically trump the desire to kill the preprocessor.

    17. Re:More on D by Anonymous Coward · · Score: 0

      When used with a static const variable, a Java compiler will compile out an if() expression that evaluates to False.

      In other words, the code will not exist, so you won't be able to "turn it on at runtime".

      If you want runtime debugging with dynamically controlled flags, C++ can do that just as easily as Java.

      Point...point...was I going to make a point? Oh well.

    18. Re:More on D by hawkstone · · Score: 1

      Q_Who: Preprocessor is most useful feature, see for example enforcer idiom by Alexandrescu and Marginean, even if it's just for __LINE__ and __FILE__

      I don't think the implication was that __LINE__ and __FILE__ are not useful. Right now they are implemented using a preprocessor, but there's no reason that has to be true. Why can't a compiler understand what line and file it is on without the need for a preprocessor? It sure can, though the language must support it. But the reason it's in the preprocessor and not C is because the C language was not designed with __LINE__ and __FILE__ in mind. With a modern language/compiler, you can include it in the design.

      Q_Who: Complain about overloading functions

      I agree, it sure sounds bad, but I've never actually run into problems personally. D does address this, though, in case you're curious. To quote: "In D, function overloading is simple. It matches exactly, it matches with implicit conversions, or it does not match. If there is more than one match, it is an error."

      And the debugging problems with opacity though preprocessor macros can get pretty bad.....

      Anyway, I'm all for getting rid of the preprocesor, as long as the functionality is retained. (e.g. We still need conditional compilation as long as there are subtle changes across operating systems.)

    19. Re:More on D by Q+Who · · Score: 1

      "In D, function overloading is simple. It matches exactly, it matches with implicit conversions, or it does not match. If there is more than one match, it is an error."

      Well, I remember reading in comp.lang.c++.moderated (can't find a reference), where a committee member said that it is most easy to define function overloading (arguably the most complex concept in C++) in exactly such terms (exact match / match via conversions / ambiguous), which makes everything fine and dandy, and also makes so many language idioms impossible, that it is simply not an option.

      I hope that D's designers have reasons for function overloading done in such way (except for language simplification for sake of it), since this simplistic policy is fully supported by C++ - the language just disambiguates many other cases.

      One has to remember, language features aren't added to the standard because someone feels sudden fountain of creativity, but rather to solve existing design problems.

      Same goes to getting rid of the preprocessor - if someone finds a way to use (new) language features such that it is no more necessary, I am all for it, especially since using the preprocessor is optional. But till then...

    20. Re:More on D by hawkstone · · Score: 1

      One has to remember, language features aren't added to the standard because someone feels sudden fountain of creativity, but rather to solve existing design problems.

      True. I admit I know very little about D, but I get the impression that simplification itself is the feature. For example, they have no multiple inheritance, which is absolutely removing functionality. (Yes, I do use MI, despite so many notable resources saying not to.) But it allows simplifying assumptions in many places, from vtbl's and RTTI through the compiler itself. So I do not see the point of D as a true "successor" of C++, but maybe more as a language with 90% of the functionality and 50% of the complexity of C++, nearly identical syntactically, but with extra features incorporated from the Java and C# camps.

      All IMHO, of course.... I've never used D.

    21. Re:More on D by Randolpho · · Score: 1

      I agree with you about macros; there's not a single thing that a macro can do that can't be accomplished with an inline function.

      --
      "Times have not become more violent. They have just become more televised."
      -Marilyn Manson
    22. Re:More on D by Anonymous Coward · · Score: 0

      there's not a single thing that a macro can do that can't be accomplished with an inline function.

      Inline this:

      #define ASSERT(n) if (!(n)) {\
      fprintf(stderr,"Assert failure, line %d of %s:\n%s\n",__LINE__,__FILE__,#n); exit(1);\
      } else

    23. Re:More on D by Anonymous Coward · · Score: 0

      If the preprocessor is removed, more functionality is going to be required in order to replace it.

      One of the most common uses for preprocessor macros is for cross-platform compatibility; which is necessary because C++ exposes C interfaces which vary slightly depending on the operating system (ironically this is due to the fact that C is the native language of most operating systems).

      The difference between pointers and references is actually important. A reference is a much safer construct, since it must always point to something. Replacing it with something like Java's object handles would be throwing away lots of functionality that people actually use.

      Java is hardly a good example of how things should work. It is probably the least expressive programming language in use today. In many cases, it can be very cumbersome to use because of its lack of language features and verbose syntax (do you really like typing "public final static int" rather than using enumerations?). Even a simple thing like returning multiple values from a method is made extremely awkward.

    24. Re:More on D by Anonymous Coward · · Score: 0

      Not having a preprocessor is one of the things I really hate about Java (and ADA). No way should be preprocessor go.

      But I do agree that C++ really sucks. I love the simplicity of the C syntax (by simple I mean it doesn't take a lot to recognise everything, and it's concise, not like ADA with "for i in 1 to 3 do" or whatever the hell it is). The C++ syntax is just so horrible though.

    25. Re:More on D by Randolpho · · Score: 1

      Or, pardon me, a change to the syntax. I thought that was implied by the thread suggesting that we, oh, I dunno, change the syntax?

      --
      "Times have not become more violent. They have just become more televised."
      -Marilyn Manson
  47. It's great to see some metaprogramming related... by exp(pi*sqrt(163)) · · Score: 4, Interesting
    ...proposals. Without metaprogramming C++ really is glorified C. But with metaprogramming C++ becomes an entirely new system. The template system is computationally complete (see here for what that means) and so important work can be shifted to compile time. That doesn't just mean computing the answer at compile time, that would be silly. It means procedurally building and optimizing code. For example we all know that C is slower than FORTRAN because pointers (lacking in FORTRAN) bring in variable aliasing problems that stop the compilers reliably optimizing. C++ metaprogramming allows us to claw back some of that loss by intelligently building optimized math routines at compile time. See Blitz++ for examples. The net effect is the speed of Fortran combined with readable high level references to array and vector objects.

    Unfortunately metaprogramming is a pain in C++. One of the biggest problems is the lack of reflection in C++ that would allow template metaprograms to easily determine type information. Some of the new proposals would remedy that issue. Also the use of local classes in templates, that is sorely lacking in the current standard, would be a great boon for such techniques.

    And maybe one day there will be many more C++ textbooks that don't just relegate templates to half a paragraph in the "advanced techniques" section. Templates are fundamental to C++. If you don't use the benefits of C++ then C++ really isn't that interesting a language. No wonder so many people propose using C rather than C++. It's like programming in Lisp but refusing to use list datastructures.

    --
    Doesn't it make you feel good to know that our freedoms are protected by politicans, lawyers and journalists.
  48. C++r0x0rz by Jad+LaFields · · Score: 1

    Now THAT would be an awesome name. (@w350|\/|3?)

    --
    [SIG] It's like putting a moose in the blender -- a recipe for disaster!
  49. Re:WHY DON'T THEY JUST CALL IT C++++ by David+P · · Score: 0

    dude, the ^ operator is for XOR, not X^Y

  50. Absurd by Anonymous Coward · · Score: 0

    How many compilers fully implement the current C++ standard properly? Remind me? It isn't ZERO is it?

    Now is not the time for a new standard.

    1. Re:Absurd by ZamesC · · Score: 1
      At least two compilers support the full Standard. (Edison Design Group and Comeau; only Comeau's is a retail product).

      However, several implement the entire standard except for one feature (export), which has a good chance of being removed from the Standard. And those "several" include the most popular ones (Microsoft Visual C++ 7.1 (aka .Net 2003), and the latest GNU).

  51. Throw that pile of junk away already by melted · · Score: 1

    Leave it as it is, in 5 years only the crazy few will be using it anyway. C++ will never become as standard as C, so making the standard book thicker is a moot point.

  52. Re:Whatever. by jkakar · · Score: 2, Insightful

    I think comments like this are often incorrectly moderated as "Flamebait". The poster makes a good point about practicality, but, at least for myself, practicality isn't enough to keep me happy and motivated. Programming is a craft; a craft involves developing and applying a collection of related and sometimes un-related skills. Craft also involves elegance. Having said all that, certainly one is able to solve many problems in C as in C++. In fact, one could probably argue that any problem solvable in C++ can also be solved in C. The difference is elegance... I think C++ makes it easier to write code that expresses the design aspect of a program without compromising the implementation; thus, well written C++ programs may be more maintainable/understable than well written C programs. Further, the biggest improvements I've made in my own programming ability has been to improve the way I do things I already know how to do; I believe that kind of behaviour has been of more benefit to me in some ways than learning how to do new things. In this sense, C++ is, as advertised, a "better C".

  53. Ever heard of planned obsolescence? by Pac · · Score: 1

    The maintainence of the economic order requires the consumers to consume. If your product lasts forever there is an upper consumer threshold after which you can close your shop and go home: you will never make a profitable sale again.

    With material goods it is only a matter of varying the quality. A car will eventually break for good, a house will fall apart. In the case of digital products, the obsolescence must be forced upon consumers by other means: new features, new standards, refusal to correct bugs (as in Windows 95 and bellow, Oracle 8x and bellow etc).

    The point is, why would you buy another compiler if the language stays the same forever and all bells and whistles are already there?

  54. Create a C++ platform like Java by Jack+Greenbaum · · Score: 2, Interesting

    One big advantage of Java is that it is a platform, not just a language. You don't have to reinvent the wheel for basic things like threading that modern systems do. In the pdf linked from the article Stroustrup proposes filling out the standard library in ways that Java already does, and think this is a good thing. STL was a start in that direction, but every C++ system I come accross seems to do threading and many other common operation over again (pwlib used in openh323 for example). I'm glad to see the C++ world recognize this type of developer need.

    1. Re:Create a C++ platform like Java by cK-Gunslinger · · Score: 1


      You mean something like adding ACE and other middleware packages to the STL? Might not be a bad idea. I agree that the STL is terribly underused.

    2. Re:Create a C++ platform like Java by mccrew · · Score: 1
      One big advantage of Java is that it is a platform, not just a language.

      In some parts, it's a religion too.

      :) <ducking>

      --
      Hey, Windows users, there is no such thing as "forward" slash, there is only slash and backslash.
  55. *sigh* by Anonymous Coward · · Score: 0

    Just wait another 10 years for the gcc team to implement it, and break binary compatibillity *again*! when will they learn?

    -1, troll^H^H^Hue.

  56. New Features by Anonymous Coward · · Score: 0

    I am just waiting for a Object-Desoriented language...

    C++0x is not a bad name, they could've called C++::ver++

  57. Re:Fake? by Anonymous Coward · · Score: 0

    Mod parent up, people need to know BS is dead and this is just a hoax!

  58. Re:SCO owns nothing but C++rap by WC+as+Kato · · Score: 2, Informative

    How can SCO own the language? I can see them owning an implementation of the compliler and libraries but the actual language? Come on, that doesn't compute, especially since it has been ANSI standardized.

    --
    --- I'm Green Hornet's sidekick not Inspector Clouseau's!
  59. hehe.. sorta by Cthefuture · · Score: 5, Insightful

    I can understand where you're coming from. C++ is a complex beast. I've been using some form of C++ for over 10 years (well before it was standardised) and I still don't understand everything about it.

    With that said, it's an extremely powerful and flexible language. Very much more powerful than Java or C#. The complexity is mostly due to its flexibility. You can do (almost) anything with it. Of course, we can argue whether that's good or bad.

    I think C++ can learn from Java though. The default should be to pass all non-built-in-type function parameters by const reference and the programmer has to specify otherwise (basically opposite of the way it is now). That would clean up the code a whole lot since 99% of the time that's what you want anyway. And the standard C++ library should have some sort of garbage collector available.

    Another problem I have with C++ is that even with all its power you have no way to get to the "left hand" variable of operations. For example, if you have a matrix class you can overload the "+" operator so that you can do things like "matrix3 = matrix1 + matrix2". However, that's not going to be very efficient (assuming that's why you're using C++ in the first place) because there is no way to get to the matrix3 variable from inside the + operator. That forces you to use a temporary variable to add the two matrices then copy by value the whole matrix after adding matrix1 and matrix2. There are tricks around this problem but none are clean.

    --
    The ratio of people to cake is too big
    1. Re:hehe.. sorta by wowbagger · · Score: 1

      It would depend upon whether the whole construction is:

      matrix operator +(const matrix &a,const matrix &b);
      matrix matrix3;
      matrix3 = matrix1 + matrix2;

      or

      matrix operator +(const matrix &a,const matrix &b);
      matrix matrix3; ....
      matrix3 = foo(); ....
      matrix3 = matrix1 + matrix2;

      In the first case, the constuctor for matrix3 will be elided and the hidden reference to the returned matrix will be passed directly into the operator +. In the second case, you MAY get an elided assignment operator but it is unlikely.

    2. Re:hehe.. sorta by dusanv · · Score: 2, Interesting

      "matrix3 = matrix1 + matrix2". However, that's not going to be very efficient (assuming that's why you're using C++ in the first place) because there is no way to get to the matrix3 variable from inside the + operator.

      Why in the world would you want access to matrix3 from the plus operator???

    3. Re:hehe.. sorta by Anonymous Coward · · Score: 0

      Passing native datatypes (int/short/float/pointers) is faster by value.

      Everything else* is usually faster by reference.

    4. Re:hehe.. sorta by egomaniac · · Score: 0

      With that said, it's an extremely powerful and flexible language. Very much more powerful than Java or C#.

      This sort of statement bugs me. A lot. First, all "real" programming languages are equally powerful -- they are all Turing-equivalent, and therefore capable of computing anything which is computable. In addition to that, modern computers provide a ton of features which aren't covered by the Turing machine, such as graphics and sound, but all real programming languages are also fully equivalent in those areas.

      So, when we say a language is more "powerful" than another language, we don't mean that it is capable of doing tasks that cannot be performed by other languages, because they can all perform the same tasks. What we really mean that it makes tasks easier than other languages. Perl, for instance, makes working with regular expressions very easy, and is therefore powerful with respect to string processing. It's easier to do this sort of thing in Perl than virtually any other language, although Perl is no more capable (in raw terms) than any other language.

      So, what you're actually arguing that C++ is easier to program in than Java or C#. And if you really, truly believe that, then I despair for the future of software engineering. That isn't idle hyperbole -- I am honestly frightened that people still consider C++ to be a reasonable programming language in the year 2003. It is a pile of hacks glued together with cruft, and C++ has been responsible for more bugs, hacks, and security holes than any other single factor in software engineering.

      Yeah, yeah, troll, flamebait, I know.

      --
      ZFS: because love is never having to say fsck
    5. Re:hehe.. sorta by Houdini91 · · Score: 2

      So the + operator function doesn't have to construct and return a temporary matrix class just to make matrix3 equal to that temporary class.

      However, as I explained in my previous post, this isn't necessary as modern compilers will optimize the temporary variable away.

      - Houdini

    6. Re:hehe.. sorta by IthnkImParanoid · · Score: 3, Informative

      Why in the world would you want access to matrix3 from the plus operator???

      To fill the matrix (which we assume is large enough to make copying the values expensive) directly, instead of copying it into a temporary matrix with the overloaded '+' operator then copying it over with the overloaded '=' operator. You could do

      MatrixAdd(const matrix& m1, const matrix& m2, matrix& result);

      but then what's the point of overloaded operators?

      --
      It's nothing but crumpled porno and Ayn Rand.
    7. Re:hehe.. sorta by Anonymous Coward · · Score: 0

      The default should be to pass all non-built-in-type function parameters by const reference ...

      "built-in-type" meaning native datatypes...

    8. Re:hehe.. sorta by Cthefuture · · Score: 1

      How do you manipulate hardware devices (ie. pointers) in Java? Ain't got the "power", eh?

      --
      The ratio of people to cake is too big
    9. Re:hehe.. sorta by Anonymous Coward · · Score: 0

      class HardwareDevice
      {
      public void Manipulate() { ...
      }
      }

      oh, wait...you mean a real hardware device?

    10. Re:hehe.. sorta by Glock27 · · Score: 1
      How do you manipulate hardware devices (ie. pointers) in Java? Ain't got the "power", eh?

      In the case where you need to do this, you need to use JNI, CNI or some other native binding. C (not C++) is a nice, small language to learn for such things.

      In the other 99.99999% of cases, JNI & C (or ASM, FORTRAN etc.) aren't needed.

      I'm pretty sure the realtime (embedded) Java extensions have some direct way to poke/peek memory.

      --
      Galileo: "The Earth revolves around the Sun!"
      Score: -1 100% Flamebait
    11. Re:hehe.. sorta by stonecypher · · Score: 1

      Another problem I have with C++ is that even with all its power you have no way to get to the "left hand" variable of operations.

      You can use a reference. C++ Gotchas, Dewhurst, Gotcha #5.

      --
      StoneCypher is Full of BS
    12. Re:hehe.. sorta by tyrecius · · Score: 1

      See Blitz++. Its amazing what one can do with turing complete templates.

      --
      char a[]="lbiitgt l e \n\n\0";main(){for(char*c=a; *(short*)c;c+=2){putchar(*(short*)c);}}
    13. Re:hehe.. sorta by stonecypher · · Score: 2, Insightful

      This sort of statement bugs me. A lot. First, all "real" programming languages are equally powerful -- they are all Turing-equivalent

      This sort of statement bugs me. It's a bit like saying that a Ferrari and a Tyco R/C are equally powerful, because they can both be used to drive a weight load from the house to the grocery store and back.

      The fact of the matter is that there's a little more to it than Turing equivalence. Sure, you could write a massively OO object exchange system in Assembly, or a language metaparser in Visual Basic, or just about anything in Befunge. They're all turing equivalent. For that matter, so is morse code to an interpreter with an abacus over tin cans and string.

      That said, in the real world we need reasonable tools to facilitate development. I have neither the time nor the patience to reinvent each and every wheel in what I make. There's a question of skill: how many of us could remake some of these mechanisms as efficiently, rigorously, or bereft of side effects (hell, even of bugs) as they currently are?

      Ahem, at least if you're not using VC. Scoping problems on for indices, indeed. If you don't know about it, google about it before flaming me, fucktards; it's a known bug with such a history that it's an option in VC.NET that actually comes shipped as default wrong. Borktastic.

      So, look, there's more to it still. Sure, writing in assembly is as turing as writing in Scheme and Haskell. But, look, let's play with C++ for a minute. Because C++ has generic programming that works in one fashion for /everyone/, then this person's template is gonna work with that other person's object. Yeah, if we were idiots, we could all each roll our own each time, but then pretty things like algorithms and iterators and so forth would be a dream.

      The fact of the matter is that if turing equivalence mattered, we'd all still be bootstrapping our mainframes with paper clips. And assembly is dead as an application writing language for a damned good reason.

      Now go back to writing VB and telling yourself that it's no different than C++. We understand.

      - Fatty, King of Contention, Arrogantest Ever (tm)

      --
      StoneCypher is Full of BS
    14. Re:hehe.. sorta by egomaniac · · Score: 1

      What sort of hardware? Graphics? Take a look at java.awt.Graphics2D. Sound? The javax.sound package. Networking? java.net has everything you need.

      Yes, I freely admit that you can't write device drivers in Java, since that's about the only point you could possibly claim and actually be correct. For the 99.9999% of us that aren't actually writing device drivers, it's completely and utterly irrelevant. Use JNI if you really need something like that, and it's still easier than trying to write the whole program in C++.

      --
      ZFS: because love is never having to say fsck
    15. Re:hehe.. sorta by Delphiki · · Score: 2, Insightful
      Oh my god, you've got to be joking. C# and Java murder performance compared to C++. They're ok if the key is to develop quickly. They're bad if the key is to run quickly. So Intel should be pushing hard for more Java and C# since it'll help drive processor demand.

      And guess, what, YES, there are problems which are easier to program in C++ than in C#. My job is mostly programming in C# and I'd rather be programming in C++.

      There is NO one right programming language or even one right type of programming language.

      --

      Feel free to mod me "-1 - Angry Jerk".

    16. Re:hehe.. sorta by egomaniac · · Score: 1

      The fact of the matter is that there's a little more to it than Turing equivalence. Sure, you could write a massively OO object exchange system in Assembly, or a language metaparser in Visual Basic, or just about anything in Befunge. They're all turing equivalent. For that matter, so is morse code to an interpreter with an abacus over tin cans and string.

      So basically, you're rehashing the rest of my message while appearing to argue with me. I'm unclear as to what exactly I said that you disagree with, quite frankly.

      --
      ZFS: because love is never having to say fsck
    17. Re:hehe.. sorta by r4lv3k · · Score: 1

      If C++ is 'more powerful than Java and C#', how come so many features that are being considered for C++0x are already in Java and C#? The reason these features are being added, is because C++ developers always have sorely needed them for modern applications, and either re-implement them (at the expense of defects) or purchase them (at the expense of expense). There are a few good free C++ libs out there, (like the OTL for database access, props to Sergei! http://otl.sourceforge.net), but not a framework as complete as Java or .NET. Most of these new features are playing catch-up to Java and C#: "XTI (eXtended Type Information)": Um, its called Reflection! "Remote instantiation, name server interface": JNDI, SOAP client stubs, Remoting cover these "Make the standard library central to bindings to other systems": JDBC, JDO (vaporware?), ADO.NET "Add a few "general utility" facilities: Hash_map, Pattern matching": System.Collections, java.util Nothing new here, move along. r4lv3k

    18. Re:hehe.. sorta by sig+cop · · Score: 0

      So the answer is "use another languague". ROTFL. How do you do generics in Java? How do you do your own memory management in Java. Believe it or not, C++ is better for some things.

    19. Re:hehe.. sorta by Cthefuture · · Score: 1

      Take a look at java.awt.Graphics2D. Sound? The javax.sound package. Networking? java.net has everything you need.

      Hehe... Sure, but those are not implemented in Java. It's only an interface to a C or C++ library. Java lacks the power to do it.

      Yes, I freely admit that you can't write device drivers in Java, since that's about the only point you could possibly claim and actually be correct. For the 99.9999% of us that aren't actually writing device drivers, it's completely and utterly irrelevant. Use JNI if you really need something like that, and it's still easier than trying to write the whole program in C++.

      Uh, but I'm not arguing how easy it is. I was just stating that Java is less powerful.

      And it is most certainly not the only point where Java lacks power. Templates? (generics have less power) Multiple inheritance? What if I don't want garbage collection? The Java specification itself prevents Java programs from ever running as fast as the fastest C/C++ proggies. I could go on.

      I write in Java too. I'm not arguing that Java isn't a good language or that it's not better than C++. I'm just saying it has less power.

      --
      The ratio of people to cake is too big
    20. Re:hehe.. sorta by fupeg · · Score: 1
      Oh my god, you've got to be joking. C# and Java murder performance compared to C++.
      That might have been true for Java like 5 years ago. Read some more modern benchmarks .
    21. Re:hehe.. sorta by Bigmell · · Score: 1

      &operator+(matrix matrix2)
      { //add matrices here
      return matrix3;
      }

      This is what I do... Im not sure but I think this allows you to do cool stuff like
      matrix1 = matrix2 = matrix3 + matrix4 (if = operator loaded in a similar way).

    22. Re:hehe.. sorta by stonecypher · · Score: 1

      So basically, you're rehashing the rest of my message while appearing to argue with me. I'm unclear as to what exactly I said that you disagree with, quite frankly.

      No, I'm going quite counter to what I interpret you as having said. Perhaps I'm misreading you?

      What I took you to have said was this: all languages have the same basic functionality (turing equivalence.) Because higher level functionality translates to ease of use, (original poster) is comparing the ease of use of C++ with Java and C#.

      I take umbrage with this. Yes, the third paragraph is a tipping of the hat to what you said: that one wouldn't want to recreate extant systems and reinvent wheels wherever they went. In that paragraph and that paragraph alone, I agree with you.

      You should read the part where it says "so, look, there's more to it still." It doesn't matter if you roll a thread system for C or C++, it's not going to become uniform, because there's too much competition. Similarly, mutexes, critical sections and other resource locks, interfaces to major resources - networks, databases/warehouses, etc - won't be unified. (The C++0x committee was talking about TCP and directories being added to the language; this scares me badly. I think it's a mistake.)

      What I was saying was different - and maybe I should have been more specific about this - was that languages offering certain features as base functionality define what can and what cannot be expected to interoperate across seperately developed software. I have long since believed that C/C++ staying far away from platform dependant stuff was a huge design consideration - one that I supported once I started doing embedded - and that as a result it had the potential for portability to platforms that silly little languages like Java had no chance on. Just try writing a GameBoy Advance game in Java.

      So, no, I'm not rehashing. I'm either misunderstanding you or disagreeing with you. It's to you to figure out which.

      And besides (I resisted saying this before but won't now) it's not C++ that's responsible for all those holes. It's bad development practice. QMail is C. The fact of the matter is that most programmers are sloppy, and are more interested with making it work than making it robust. We need better practice, better idioms, better understanding of vulnerabilities, and management that understands that meeting a deadline should come with hardening, not with stability, before this profession can be called an engineering discipline.

      Managers that want salability instead of proof are the real problem. And until we have a way of displaying hardening, they can't turn hardening into a selling point. Having a metric for resilience was what made resilience a responsibility. Don't complain. Work on the problem.

      (Also, a pile of hacks glued together with cruft? I challenge you to defend that with concrete examples rather than your sesquipedalianic "hyperbole", and to not turn bright red when I throw things like PL/I in your face. Have a look at the MFC, the Mac OS8 API, the Winders ME API, or Linux 2.something . C++ is anything but hackish when you've been in the real world. Can you name a language that's anywhere near as flexible that isn't so cobbled together besides Ruby or Smalltalk? Oh, wait, there's so much they don't do. Do I need to keep giving examples, or will the sarcasm hit home early on?)

      --
      StoneCypher is Full of BS
    23. Re:hehe.. sorta by Q+Who · · Score: 1

      LMAO!

    24. Re:hehe.. sorta by Q+Who · · Score: 1

      You are living in a dream. Seriously.

      One thing is to pretend Java is not slow. Another thing is to believe it.

      "Performance difference is negligible for our purposes" is entirely different from "Java is as fast as C++".

      Heh, yeah right, "benchmarks"...

    25. Re:hehe.. sorta by Pete · · Score: 1
      So basically, you're rehashing the rest of my message while appearing to argue with me. I'm unclear as to what exactly I said that you disagree with, quite frankly.

      As far as I could tell, stonecypher appeared to be using overwhelming, excessive, way-over-the-top sarcasm to make a point. And you still missed it :-).

      The point of stonecypher's statement(s) is that while you could write "a massively OO object exchange system in assembly"... or indeed implement any other kind of software development project in an utterly inappropriate programming language... it would be ludicrous to do so.

      Implying that all programming languages are equally powerful because they're all Turing equivalent is - well, it's nonsense. Paul Graham explains it much better than I can in his article Beating the Averages. Focus on the section labelled "The Blub Paradox", although the rest of the article is also good.

      Essentially, just because two programming languages are Turing equivalent, that doesn't mean anything about how powerful they are. Similarly, just because two human-controllable vehicles both have wheels and travel along the ground doesn't mean you can equate a skateboard to a car.

      A good line I've heard a few times about these sort of language non-comparisons is something like "yeah, you can do this in C, but only by writing a Lisp interpreter in C and then writing the rest in Lisp!" Codified (slightly) more formally as Greenspun's Tenth Law/Rule of Programming: "Any sufficiently complicated C or Fortran program contains an ad-hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp."

      Pete.
    26. Re:hehe.. sorta by Q+Who · · Score: 1

      Let me understand, C++ lacks some features present in Java/C#, therefore it is not more powerful?

    27. Re:hehe.. sorta by Anonymous Coward · · Score: 0

      MOD PARENT 'Doesn't Know Anything About Efficiency'!!

    28. Re:hehe.. sorta by Anonymous Coward · · Score: 0

      Granted C# does kill performance now, but will it? Doubtful. If MS keeps hammering away at the .NET framework like they should, it will probably be so integrated into the OS, that managed langauges like C# will only be marginally slower. Will they continue to be slower than straight C/C++? Well obviously, yes, as we all know, having background threads which manage all of our references takes computing power. However, if the entire system were to be tightly bound to the 'managed' paradigm, unmanaged code probably wouldn't run that much faster (if it was allowed by the system to run at all).

      You can't possibly tell me that if you've worked with: ATL/COM/COM+/DCOM/MFC/Win32 API that you'd still rather shoot yourself in the foot than use C#. I haven't met one single person who enjoyed writing for Windows more than for .NET, save for a few VB guys, because VB was written so as to wintegrate easily with COM technologies, and upgrading to VB.NET gives you marginal RAD gains.

    29. Re:hehe.. sorta by egomaniac · · Score: 1

      Oh my god, you've got to be joking. C# and Java murder performance compared to C++.

      I'll be the first to admit that Java still has some performance hurdles to overcome -- notably that independent VMs still don't share memory, and that graphics performance is still poor -- but you've got to be joking if you think that C++ "murders" Java's performance. Either that, or you haven't actually used it recently.

      For virtually any sort of program that doesn't depend upon high-performance graphics (games, video editing, and the like) Java's performance is more than adequate. In fact, gcc's code generation isn't exactly stellar, either -- Java actually beats it in a number of benchmarks.

      --
      ZFS: because love is never having to say fsck
    30. Re:hehe.. sorta by Cthefuture · · Score: 1

      Everyone who keeps specifying the operator as operator+(matrix1, matrix2) is wrong. That's not the way you overload the + operator. This seems to indicate that many people on this thread are blasting away and have no idea how to program in C++. Anyway...

      But what are you returning a reference to? For example (simplified):

      matrix& operator+(const matrix& m)
      {
      matrix temp_matrix;

      temp_matrix[0] = m[0] + (*this)[0];
      temp_matrix[1] = m[1] + (*this)[1];
      etc...or use a for-loop, whatever...

      return ...What??? temp_matrix is the result
      }

      You can't return a reference temp_matrix because it's about to go out of scope (a good compiler will warn you about this).

      If you did do that, it would still still work if you forced it into a value type:
      matrix matrix3 = matrix1 + matrix2;

      But at that point you are not using the reference. The reference would be copied by value into matrix3. Of course compilers these days can sometimes optimize that away, but not always.

      If you could access the left side of the equation then you wouldn't need temp_matrix at all.

      --
      The ratio of people to cake is too big
    31. Re:hehe.. sorta by Cthefuture · · Score: 1

      I haven't read that book so I don't know specifically what you're talking about but... You can't return a reference to a temporary variable.

      I just did another post on this here.

      --
      The ratio of people to cake is too big
    32. Re:hehe.. sorta by Cthefuture · · Score: 1

      If you did do that, it would still still work if you forced it into a value type:
      matrix matrix3 = matrix1 + matrix2;


      I should qualify that and say it might work. Technically the variable is out of scope and matrix3 contains an invalid value. I'm not sure what the standard says about that though.

      --
      The ratio of people to cake is too big
    33. Re:hehe.. sorta by WaKall · · Score: 1

      The lesson that java preaches here is "don't overload/override operators".

      Seriously, you can write a function that does that as efficiently as you're describing. Do you really need the operator syntax in every case?

    34. Re:hehe.. sorta by J.+Random+Software · · Score: 1
      You can't do that in C++ either. The moment you try, you've switched to a machine-specific superset of the standard language.

      Access to memory-mapped devices, or any other kinds of nonportable crap, belongs in the JVM implementation itself.

    35. Re:hehe.. sorta by Glock27 · · Score: 1
      So the answer is "use another languague". ROTFL. How do you do generics in Java?

      You complained (essentially) about the lack of a "peek" and "poke" primitive - not exactly rocket science, or a "power" programming language feature. Java was always advertised as a "C" family language, and learning C is not that difficult. Learning C++ (especially well) is quite difficult.

      How do you do generics in Java?

      Given that generics aren't necessary in Java, I don't. There have been preprocessors (Pizza etc.) for quite a while.

      Generics will be part of 'standard' Java in JDK 1.5, IIRC.

      How do you do your own memory management in Java.

      I use the realtime extensions, gcj, or some other Java environment that gives me the control I want or desire.

      Believe it or not, C++ is better for some things.

      True C or C++ are better for some things, though there is generally something better than C++ in the same space. Java is really a better choice for 90%+ of software today...and the marketplace is slowly catching on to this fact.

      --
      Galileo: "The Earth revolves around the Sun!"
      Score: -1 100% Flamebait
    36. Re:hehe.. sorta by chicogeek · · Score: 1

      Would you please be so kind as to define your terms. Namely, what definition are you using for "power"? If your definition is that you must be able to use pointers, then C++ is more powerful than Java. In my case I might choose to define it as writing a particular application in the fewest lines, and in most of these cases Java or C# are far more "powerful" than C++.

    37. Re:hehe.. sorta by J.+Random+Software · · Score: 1

      malloc/free has O(dead objects) overhead, while GC has O(live objects) overhead. Which one is faster depends entirely on the overhead per object, and how many objects are alive and dead. The improved locality a copying collector (which defragments memory) brings further complicates the result.

    38. Re:hehe.. sorta by Cthefuture · · Score: 1

      Do you really need the operator syntax in every case?

      I could rewrite the entire Linux kernel in 100% assembly language too. Doesn't mean I'd want to.

      Operator overloading can be abused but when used correctly it goes a long ways towards making the code more readable. It allows constructs that are easy to code up and visualize. I mean, making the programmer's job easier is a good thing, no?

      Think about this, in Java we don't need function overloading either. So why use it?

      Hell, we don't need object-oriented stuff at all. Just use some flat language that doesn't support encapsulation, inheritance, function overloading, or ... You don't need OOP to write software that does what you want.

      --
      The ratio of people to cake is too big
    39. Re:hehe.. sorta by nomis80 · · Score: 1
      Another problem I have with C++ is that even with all its power you have no way to get to the "left hand" variable of operations. For example, if you have a matrix class you can overload the "+" operator so that you can do things like "matrix3 = matrix1 + matrix2". However, that's not going to be very efficient (assuming that's why you're using C++ in the first place) because there is no way to get to the matrix3 variable from inside the + operator. That forces you to use a temporary variable to add the two matrices then copy by value the whole matrix after adding matrix1 and matrix2. There are tricks around this problem but none are clean.

      You might want to check out expression templates. This is an advanced technique that addresses exactly your problem. With this technique, you can do stuff like this:

      A = B + C - D * E / J;

      ... and this will get translated to:

      for (i = 0; ...) {
      for (j = 0; ...) {
      A[i,j] = B[i,j] + C[i,j] - D[i,j] * E[i,j] / J[i,j];
      }
      }

      The Blitz++ library is the foremost library that uses expression templates. Check it out! There are ways around C++'s shortcomings...

    40. Re:hehe.. sorta by Jeremi · · Score: 1
      So, what you're actually arguing that C++ is easier to program in than Java or C#. And if you really, truly believe that, then I despair for the future of software engineering.


      You're assuming that everyone faces the same sorts of programming tasks that you do, and therefore the tools you find best are best tools for everyone. That's not a valid assumption. One size does not fit all.

      --


      I don't care if it's 90,000 hectares. That lake was not my doing.
    41. Re:hehe.. sorta by Bingo+Foo · · Score: 1

      Wow, this sure has turned into an enlightening discussion about the new proposed features of C++0x!

      --
      taken! (by Davidleeroth) Thanks Bingo Foo!
    42. Re:hehe.. sorta by sebmol · · Score: 1

      This is a mutuallly dependent process. Java and C# got large parts of their syntax and semantics from C and C++.

      --
      "Light is faster than sound." - "Is that why people tend to look bright until you hear them speak?"
    43. Re:hehe.. sorta by Paradise+Pete · · Score: 1
      However, as I explained in my previous post, this isn't necessary as modern compilers will optimize the temporary variable away.

      Sure, but there still could be substantial work avoided with direct access to the assignee. It may turn out that a few simple changes are all that's required, but without access an entire object has to be constructed anyway.

    44. Re:hehe.. sorta by Nevyn · · Score: 2, Interesting
      but then what's the point of overloaded operators?
      Indeed, using a function is more readable; more efficent; and allows you to have more than one idea of an add for a complicated type (without doing heniously confusing things with different types on the right hand side), the C programers have been saying this for years.
      --
      ustr: Managed string API with ave. 44% overhead over strdup(), for 0-20B
    45. Re:hehe.. sorta by mkettler · · Score: 1

      And why not simply do:

      matrix3 = matrix1;
      matrix3 += matrix2;

      This should achieve the stated goal of avoiding copy to a temporary and allows use of overloaded operators.

      Seems simple and straightforward to me.

      --
      -Matt
    46. Re:hehe.. sorta by Anonymous Coward · · Score: 0

      >> take umbrage with this.

      Do you talk like that too? The people around you must not like you very much. I don't. You sound very uppity. Like you think you're too good to express yourself in more common terms.

      Pity. Because otherwise what you write makes a lot of sense. You're obviously a smart one.

    47. Re:hehe.. sorta by stonecypher · · Score: 1

      Do you talk like that too?

      When you use the correct word, you evoke subtleties for intelligent readers. Also, you attract the enmity of morons who follow you around slashdot trying to make you look bad with third grade snips at the way you talk and how people around you supposedly must react.

      And, no, I don't seem to have many real world social issues; still, yes, when I criticize people for bad argument, especially in online forums which allow anonymity, I do get tweakers (not the techie meaning) every so often.

      Rather than stalking me, you should consider trying to come up with something worth saying.

      Like you think you're too good to express yourself in more common terms.

      I'm sure when you learn the words (that is, from usage, not from your dictionary) you'll understand why I chose them, and not things you could find in a beer commercial.

      --
      StoneCypher is Full of BS
    48. Re:hehe.. sorta by stonecypher · · Score: 1

      As far as I could tell, stonecypher appeared to be using overwhelming, excessive, way-over-the-top sarcasm to make a point. And you still missed it :-).

      That's redundant, repetetive, reiterative, and deadly fucking accurate. You might just be the next MC Hawking. Mad word. Keep the S/N high.

      --
      StoneCypher is Full of BS
    49. Re:hehe.. sorta by Jeremi · · Score: 1

      ... and the first thing they did was break their own rule by overloading the plus operator for the String class. Did they really need to do that when people could have just called String.append() all over the place? If the answer is yes, then there is an argument for why overloaded operators are useful.

      --


      I don't care if it's 90,000 hectares. That lake was not my doing.
    50. Re:hehe.. sorta by Anonymous Coward · · Score: 0

      If you return temp_matrix then you are correct about scope.

      However, these functions/operators should be a "black box" along with the data of the matrix class.

      The matrix class should have a private member variable named temp_add or something for the + operator to use as its return value.

      Now, with temp_add being a member of the class, not a scope-variable of operator+(), you can return temp_add and all will be fine.

      Also, since operator+() will only be called once at a time and no recursion occurs, you can do things like:

      sum = matrix1 + matrix2 + matrix3 + matrix4;
      and temp_add won't be overwriting any values needed.

      it doesn't have to be temp_add, though, you can make just one temporary variable and let it be used for addition/subtraction.

      value = matrix1 + matrix2 - matrix3;
      That would still work even if operator+() and operator-() used a variable named "temp_val."

    51. Re:hehe.. sorta by Lord+Ender · · Score: 1

      You mean the language doesn't make a temp which contains matrix1+matrix2 and then rename the matrix3 variable to be that temp? I mean, the temp isn't needed anymore.

      --
      A slashdotter who didn't build his own computer is like a Jedi who didn't build his own lightsaber.
    52. Re:hehe.. sorta by Anonymous Coward · · Score: 0

      The funny thing is that you take the time to respond. It's a fine distraction for a guy like me.

      Not that I'm a moron by any means. Yes you have your own opinion on the matter. But I've been coding for the last 22 days straight. My otherwise intelligent brain is quite fried. I needed something to keep myself busy for a couple of minutes while I thought through a particularly vexing problem. Slashdot seemed too top heavy. I was considering User Friendly or Snoopy and then I saw the mmkay. My fix was found.

      You may be delighted to know that mmkay is now a variable name in a very, very big financial system. Congrats.

    53. Re:hehe.. sorta by Anonymous Coward · · Score: 0
      I hope the maintenance programmer who comes across the "mmkay" variable name fucks your dog.

      Unless you're the maintenance programmer in which case I hope your dog fucks you.

    54. Re:hehe.. sorta by Anonymous Coward · · Score: 0

      There are jobs for programming in C#?

    55. Re:hehe.. sorta by LizardKing · · Score: 1

      Java and C# got large parts of their syntax and semantics from C and C++.

      C and Objective-C actually - the influence of C++ on Java was minimal except in the "that's how not to do it" sense. There's two main strands of OOP languages, those that can trace their lineage back to Modula and those that trace it back to Smalltalk. Java (and C# as it's just MS Java), are more heavily influenced by the Smalltalk style of OOP.

      Chris

    56. Re:hehe.. sorta by Anonymous Coward · · Score: 0

      > For example, if you have a matrix class you can overload the "+" operator
      > so that you can do things like "matrix3 = matrix1 + matrix2".
      > However, that's not going to be very efficient (assuming that's why you're using C++ in the first place)
      > because there is no way to get to the matrix3 variable from inside the + operator"

      You can do that efficiently by using a helper class:

      class matrixAdditionPromise
      {
      public:
      matrixAdditionPromise( matrix const & a, matrix const & b)
      : m_a( a), m_b( b)
      {}
      matrix const & m_a;
      matrix const & m_b;
      };
      matrixAdditionPromise & operator+( matrix const & a, matrix const & b);

      matrix & matrix::operator=( matrixAdditionPromise const & x);

      Now operator= has access to all three matrices.

    57. Re:hehe.. sorta by HoppQ · · Score: 1
      There are tricks around this problem but none are clean.


      You mean like
      reference counting? Makes copying large objects efficient and you should be using something like the handle-body idiom anyway (because of certain stupidities of the C++ language and its implementations).
      --
      My sig will be released in 2015 third quarter. Rating pending.
    58. Re:hehe.. sorta by Anonymous Coward · · Score: 0

      By the tone of your comments I believe that you have first hand experience with this kind of thing.

      How far do you go? Dogs? Sheep? Snakes? Do you sneak into the local zoo and go for a little monkey love?

    59. Re:hehe.. sorta by lahi · · Score: 1

      If I had to choose between implementing a LISP in C or implementing a LISP in C++ I definitely wouldn't pick C++ (or I'd stick to its ANSI C subset). Given that the C++ template system is Turing complete in its own right, I'd risk the compilation would never terminate!

      -Lasse

    60. Re:hehe.. sorta by Anonymous Coward · · Score: 0

      just don't make it a member function. (just because it's related to the class doesn't mean it has to be a member).

      Matrix operator+(const Matrix&, const Matrix&);

      alex

    61. Re:hehe.. sorta by Anonymous Coward · · Score: 0

      Eh? That still won't let you get to the left hand matrix variable. By your prototype you still have to copy by value the whole result matrix.

    62. Re:hehe.. sorta by Anonymous Coward · · Score: 0

      Reference counting and/or hadle-body stuff is not a proper solution. They both have overhead that will slow down high performance applications.

    63. Re:hehe.. sorta by Anonymous Coward · · Score: 0

      Although an interesting solution, this has some performance overhead. You're creating the temporary matrixAdditionPromise object and copying a couple (pointer) values.

      It would be faster to pass the "output" matrix as a parameter and fill it.

      If you could just get to the left-hand "output" variable then it would be fast and allow proper operator overloading.

  60. C++0x's biggest new feature... by Arslan+ibn+Da'ud · · Score: 2, Interesting
    Smart Pointers!!!

    If they can do this right, I'll be very happy. After all, Java's main advantage over C++ is their abstracting away pointers. Course Java is still slow, and that pointer abstraction is expensive, in terms of garbage collection, program speed, and (most important) huge memory footprint. C++ pointers are a major PITA, but they are fast 'n cheap. How fast 'n cheap are smart pointers?????

    --

    Practice Kind Randomness and Beautiful Acts of Nonsense.

    1. Re:C++0x's biggest new feature... by Tony+Hoyle · · Score: 2, Informative

      Smart pointers are relatively trivial to implement using templates, and don't slow things down much (small overhead as the pointer struct is 8 bytes + a trivial copy constructor every time you pass it). You only need a GC to cope with things like loops (a points to b which contains a pointer back to a, which means their reference counts will never be zero). If your careful you can get away without one at all.

      I don't think it impacts memory footprint much... if you remember to set pointers to null when you've finished with them they'll free at roughly the same places as if you did it manually... with the advantage they won't leak if you forget.

    2. Re:C++0x's biggest new feature... by Homology · · Score: 1

      Have a look at www.Boost.org smart pointers, that is proposed as a standard.

    3. Re:C++0x's biggest new feature... by be-fan · · Score: 3, Informative

      Smart pointers are pretty fast and cheap, because they're reference counted. Basically, there are the following costs:

      1) Creating a smart pointer involves an extra heap allocation to allocate a counter. This is necessary because boost's smart pointers (which are the basis of the standard) are non-intrusive --- they don't require giving the target object a special counter. This overhead, can be eliminated by using intersive_ptr, which allows you to put the counter inside the object itself, and provide functions to increment/decrement it.
      2) Copying a smart pointer involves an atomic increment of a counter.
      3) Having a smart pointer go out of scope involves an atomic decrement of a counter.
      4) When the last smart pointer is destructed, an extra heap free is needed to free the counter.

      --
      A deep unwavering belief is a sure sign you're missing something...
    4. Re:C++0x's biggest new feature... by ozzee · · Score: 1

      There is a discussion on comp.std.c++ about this. Some would argue that the boost smart pointers (the ones proposed in the standard) are too heavy. Other than that, smart pointers can be as fast as regular pointers if implemented efficiently.

    5. Re:C++0x's biggest new feature... by be-fan · · Score: 2, Informative

      You shouldn't set smart pointers to null. That could lead to a bug if you accidentally access it afterwords. Just let the destructor do the work, and make sure you don't create a smart pointer whose scope is much larger than it needs to be. Heck, that's good advice even for regular pointers.

      --
      A deep unwavering belief is a sure sign you're missing something...
    6. Re:C++0x's biggest new feature... by stripes · · Score: 1
      How fast 'n cheap are smart pointers?????

      Indirecting through them is quite fast, copying them is much more costly then for normal pointers (because there is a reference count involved), but the total work is still quite tiny. Throwing them away again is much more costly (there is actually a real destructor, and it decrements a value as opposed to the normal "do absolutely nothing at all"). However in real use I have a program that used 2.7% of the CPU before using boost's implementation of them, and it went all the way up to 2.7% afterwards. So at least in my case it was unmesurable.

      Anyway as it is just a library issue, and a freely re-distributable open source implementation is available now (I think boost uses a BSDL like license), why wait for C++0x?

      Boost also has a lot of other useful stuff in it, and a lot of stuff I don't find useful. It is worth some time to poke through though.

  61. How Do You Pronounce That?? by cgifool · · Score: 2, Funny

    "cee plus plus ox?"
    "cox?"
    "kooks?"

    1. Re:How Do You Pronounce That?? by Anonymous Coward · · Score: 0

      C++0x.

      That'd be Docks.

    2. Re:How Do You Pronounce That?? by Anonymous Coward · · Score: 1, Funny

      Kappaplox?
      (gesundheit)
      Whoa! I don't remember eating that!

    3. Re:How Do You Pronounce That?? by slide-rule · · Score: 1

      "cuh-plus-plu-sox"

  62. Re:Fake? by Horizon_99 · · Score: 1

    The link is from att research and it point to the home page of M. Stroustrup (http://www.research.att.com/~bs/). I think it's safe to assume this is not a hoax.

  63. Uh, no. by devphil · · Score: 4, Insightful
    Everyone knows the history of C, coming from B, which came from A.

    Everyone but you, friend.

    The language C was descended from the language B, which was descended from the language BCPL. Dennis Ritchie never decided whether C followed B because it was alphabetical (in which case C++ would have been D), or whether C followed B because it was the next letter in BCPL (in which case C++ would have been P).

    As for the C++0x thing, it's quite common to call languages by the year of their standardization, thus "FORTRAN77", "FORTRAN90", "C89", "C99", "C++98". The next cycle for C++ will be completed sometime in the next seven years, but we don't know exactly which year, so "0x".

    Either way, it doesn't look too exciting judging from these proposals. It's certainly nothing on the scale of Perl 6 compared to Perl 5, so yeah, maybe I've answered my own question. This is just a routine standards adjustment, rather than a real 'development.'

    Again, uh, no. If it doesn't look "exciting," perhaps you're simply looking at the wrong proposals. Or perhaps you simply still think of C++ as "C with more type checking, and those // comments."

    The routine standards adjustment came in the form of "TC1", which was just recently published. Basically, "C++98.0.3p4rc2", to put it in Linux terms. Just bugfixes. C++0x is a different story.

    (And I don't know that I'd call Perl 6 particularly innovative, either.)

    --
    You cannot apply a technological solution to a sociological problem. (Edwards' Law)
    1. Re:Uh, no. by joeykiller · · Score: 1
      (And I don't know that I'd call Perl 6 particularly innovative, either.)

      Actually, I don't know if anyone knows if Perl 6's innovative yet. To me, at least, Perl 6 at the point seems to be the VM (Parrot) and a lot of different proposals. What'll end up in Perl 6 eventually I don't think even Larry Wall's sure of yet. [Those of you that attendeded the Open Source Conference i Portland this summer, and attended Larry's State of the Onion speech, may know things about Perl 6 I don't.]

      One off topic thing, though: The proposals for Perl 6 sure as hell looks alien and scary to me, a long time user of Perl 5. But then again, when I first started dabbling in Perl the whole thing lookes alien and scary. It still does, but now I love it. So I guess Perl 6'll turn out alright, even if it ends up not being innovative at all.
    2. Re:Uh, no. by yamla · · Score: 1

      C99 added C++-style comments, iirc. So C++ can no longer be viewed as C with those // comments.

      --

      Oceania has always been at war with Eastasia.
    3. Re:Uh, no. by Anonymous Coward · · Score: 0

      > it's quite common to call languages by the year
      > of their standardization, thus "FORTRAN77",
      > "FORTRAN90" ...

      Actually, Fortran 90 was called Fortran 8x during
      most of its development. It was only after 1988
      that people began to question whether 'x' perhaps
      meant a hexadecimal digit ...

      Toon Moene.

    4. Re:Uh, no. by cpeterso · · Score: 1


      Since C was not making B more like BCPL, I cannot believe that the name C was chosen because it was the next letter in the name BCPL.

    5. Re:Uh, no. by Anonymous Coward · · Score: 0

      [...] or whether C followed B because it was the next letter in BCPL (in which case C++ would have been P).

      P, eh? Well, I don't know about you, but I don't think I'd like the reaction I'd get from a non-technical person... "Yeah, I program in P." "In the snow?"

  64. Wrong by Anonymous Coward · · Score: 0

    Visual Studio.NET 2003 works fine with any sort of template madness you throw at it: Partial template specialization, etc. Except for export, which is supposedly extremely difficult to implement.

  65. Re:Whatever. by Austerity+Empowers · · Score: 5, Insightful

    I think C++ is quite useful, and I'm not a "2 week IT person", not that I think they are necessarily inferior beings. On another note, most IT people I know tend to make the most use of Perl/Ruby/Python since it solves most of their problems quickest.

    Straight C is my favorite tool and what I use for embedded programming, quick hacks and performance constrained work. Every time I try to do a large application with it though, I find myself thinking "you know, they already did this exact thing with C++, and I'm going to spend 2 days re-inventing this and testing it".

    I use tidbits of Assembly (80x86, MIPS, Arm, PowerPC, what have you) in embedded systems for device driver or performance critical sections. As a HW engineer I tend to use this a lot in bringup of new designs, especially "very new" designs that don't necessarily work and every instruction is important.

    I use C++ when I am building a very large, flexible application where I use many types of data structures and need it to get up and running in a short period of time. I like this language for "serious application" programming.

    I use Perl to manage my file system, do text processing and other maintenance hacks.

    I use Java for simple GUIs that often work as a front end for serious endeavors.

    I use TCL/TK for ASIC/FGPA debugging (simulator interface) and test suites.

    I use fortran less and less (often I convert to C) for purely numerical computation. Gems of knowledge exist in fortran code for optimized matrix related algorithms that are highly useful in 3D visualization.

    I have not found any practical use for Pascal or Lisp lately (the latter is useful for emacs, but I rarely mess with it).

    The point of all this is that much like you wouldn't use a screwdriver to drive a nail through wood (unless that was all that was available), you would tend to use whatever tool is best suited to a task. Us engineer types are supposed to be tool-makers and users of the highest order. It surprises me when I hear one of us suggest we should use our favorite tool to the exclusion of all others.

    I do not like C++ in terms of the performance and memory impact it infers, but when building large applications I do not have time to re-invent a linked list for the umpteenth time, nor do I want to debug every different link list in my code, there are much harder problems to solve more critical to the success of my project. That said, C++ (and C for that matter) is lacking in some very important things. Among those I think are critical are: multithreading, network stack framework (platform independent that is) and GUI framework (platform independent!). If you read the article, you'll see mention of at least two of those things (we need a standard platform independent GUI library dammit!)

  66. Lack? by cje · · Score: 1

    I think what C and C++ really lack is the option to turn on array range checking.

    How do C and C++, as languages, lack this? You're talking about specific implementations of the languages, not the languages themselves. When you read or write outside of array bounds, the language standards say in no uncertain terms that the behavior is undefined. That means that anything (and everything) can happen. Permissible undefined behavior includes printing an error message such as "Attempt to write outside of array bounds at line 427 of foo.c."

    There is nothing in the language standards that prevent runtime array bounds checking. The reason why you don't see many implementations doing it is the performance hit, which works against one of the biggest selling points of C and C++ (speed.) And, as you say, there already exist tools with which you can diagnose runtime memory problems.

    --
    We're going down, in a spiral to the ground
    1. Re:Lack? by Hard_Code · · Score: 2, Insightful

      Uh, just leaving it as "undefined" so that implemenations MAY (or most probably will not) define some useful behavoir...is far from useful.

      Instead of leaving it as "undefined", they should define it as "If compiled with array range checking so and so exception should be thrown with the name of the variable and line (given debugging info is one)" or something...so that at least it is USEFUL.

      --

      It's 10 PM. Do you know if you're un-American?
    2. Re:Lack? by GlassHeart · · Score: 1
      Instead of leaving it as "undefined", they should define it as "If compiled with array range checking so and so exception should be thrown with the name of the variable and line (given debugging info is one)" or something...so that at least it is USEFUL.

      Understand that anything written into a language standard must be implemented by everybody, or you'll have a good number of compilers that are non-conforming. In small embedded systems, in particular, array bounds checking is a very expensive and potentially crippling requirement.

      Ask your favorite compiler vendor to implement whatever additional feature you like. There's no need to define it into the language.

    3. Re:Lack? by Anonymous Coward · · Score: 0

      I rarely use plain arrays - I have an array and matrix class which may have bounds checking turned on or off as required. IMHO this is far more useful than 'on' or 'off': eg. in my long-running simulations I don't always want *all* accesses to be ranged-checked, since that can make it run ridiculously slowly. Rather the range- (and other-) checking can be on a per-object basis.

      Admittedly this isn't in the standard library, and I do dislike the way a separate function is used for range checking ([] vs. at()), but since writing those classes isn't *especially* tricky, I'm not bothered...but I wouldn't object if they were in C++0x ;)

      --
      Neil

    4. Re:Lack? by Minna+Kirai · · Score: 1

      Ask your favorite compiler vendor to implement whatever additional feature you like.

      That request should really be directed to a library vendor. It's already possible (even easy) to write bound-checked array classes in C++.

      A guiding principle of C++ development was not to force features into the language itself if they could be implemented in terms of the language. (This is why C++ has std::string, unlike Java's native String which behaves unlike any class a library could provide)

      If a compiler author accedes to this request, and you use it in your programs, then what you write can no longer be called "C++ code". That's a bad portent for future portability. Write to an optional C++ library, and you can at least expect to move the program to another compiler someday.

    5. Re:Lack? by Ben+Hutchings · · Score: 1

      It's very useful, because not everyone wants to pay the run-time cost of range-checking. Why should their programs run slower just because you can't get array indexing right? ;-)

    6. Re:Lack? by Hard_Code · · Score: 1

      I'd rather have non-conforming compilers in specific identifiable cases, than no specification whatsoever which leads to all compilers being "non-conforming" by de facto.

      --

      It's 10 PM. Do you know if you're un-American?
    7. Re:Lack? by GlassHeart · · Score: 1
      I'd rather have non-conforming compilers in specific identifiable cases, than no specification whatsoever which leads to all compilers being "non-conforming" by de facto.

      That doesn't really make a big difference in real life. For networking, you'll probably use the de facto standard Berkeley sockets. For 3-D graphics, you'll probably use OpenGL or DirectX. GUIs are an area where this approach is particularly weak, but it's unlikely that the C or C++ committees can come up with a unifying cross-platform API to satisfy anybody anyway. The mainstream of GUI apps are still native code linked against platform specific GUI API.

  67. Y2.1K Bug? by Anonymous Coward · · Score: 0

    Let's hope nobody is still using this language and nomenclature in the 2100's. They'll be dreadfully flummoxed when their own C++0x standard gets confused with one that is a century older. Then again, this, like the Y2K bug, is a good way to drum up business for our greatgrandkids and strengthen our technocracy. Muahahahahah!!!

  68. The answer to your question is.. by Anonymous Coward · · Score: 0
    within the following "interview".. :)

    It's now official. C++ creator admits it was all a hoax! Read on for the details of the stunning scoop...

    On the 1st of January, 2003, Bjarne Stroustrup gave an interview to the IEEE's 'Computer' magazine.

    Naturally, the editors thought he would be giving a retrospective view of twelve years of object-oriented design, using the language he created.

    By the end of the interview, the interviewer got more than he had bargained for and, subsequently, the editor decided to suppress its contents, 'for the good of the industry' but, as with many of these things, there was a leak.

    Here is a complete transcript of what was was said, unedited, and unrehearsed, so it isn't as neat as planned interviews.

    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 ridiculously 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.

  69. Fragile Base Class problem (whining follows) by mcc · · Score: 2, Interesting

    So, are they ever going to do anything about the Fragile Base Class problem? I don't see anything related in those proposals.

    I'm tired, so forgive me if i explain this poorly, but C++ has this issue where, since object methods are really just function pointers, if you have class A that is shipped as a library or API, and class B which inherits from class A and is part of some third-party program, and the people who make class A add a private method or private variable to class A and then re-ship their libraries, every existing binary containing class B breaks becuase C++ just slaps a struct containing Bs methods and variables at the end of A, and becuase the size of A has changed the offsets have all changed.

    This is horrible. This completely negates the purposes of encapsulization and information hiding, which is the entire reason you'd be writing an OO API in the first place, and leads to anyone attempting to create a C++ API doing horrible workarounds like sticking a whole bunch of dead space in the form of methods named, for example, "reserved_23" at the end of every class they make, just so that in case later they have to add a method or instance variable they'll have a little bit of room to do so without breaking everyone who's ever inherited from them.

    Until they fix this, and until they reach the point where there is some kind of standard String class that everyone uses (as is, there are an untold number of String classes, one for just about every major C++ API, and so from what i've seen people rarely if ever store their strings as anything other than c-strings just because in the end, all they're going to do with their strings is pass them to other c or c++ libraries.. who expect to be given c-strings..), I will continue to consider C++ to be more or less a huge joke that can be used as a high-level oo programming language, but only by coincidence.

    Also note that they still are not even considering adding any sort of real reflection into the language, nor are they considering adding a real, robust macro system despite the fact people clearly want one (or else they wouldn't be trying to metaprogram the C++ template system to be a macro system!). It would be nice to be able to typedef a single variable type that acts as a template, though.. that's a good innovation, if i'm reading that right. Anything that minimizes the contact I have with the C++ template system makes me happy. (If it were up to me, they would add ML-like syntax where you can say something like 'typedef myinttype = int | long | IntegerClass | BigInt;' and it would automatically generate the templates for me whenever i used a myinttype in a function.) Of course, considering how long the major compiler makers took to all implement C++ in a standard fashion (the STL doesn't really even seem standard across all the platforms i use, yet), it will probably be a long time before i can safely use any C++0x features :P

    I will, however, support the spread of C++0x, just becuase that will make it the first major language whose name is written in leetspeak.

    1. Re:Fragile Base Class problem (whining follows) by Anonymous Coward · · Score: 1, Informative

      You should read Herb Sutter's article on Compilation Firewalls (aka the Pimpl Idiom). It basically solves exactly your problem.

    2. Re:Fragile Base Class problem (whining follows) by be-fan · · Score: 1

      The fragile base class problem is only an issue for those using closed source libraries. Sucks to be you if this is the case. There is no way to get rid of the fragile basic class issue without making classes *much* slower and breaking the semantics of the C memory model.

      --
      A deep unwavering belief is a sure sign you're missing something...
    3. Re:Fragile Base Class problem (whining follows) by Matthew+Austern · · Score: 1
      until they reach the point where there is some kind of standard String class

      In what way do you not regard std::string as a standard string class?

    4. Re:Fragile Base Class problem (whining follows) by mcc · · Score: 1

      In what way do you not regard std::string as a standard string class?

      I've never met a single person who uses it?

      That means that, while it may be a standard string class, it is, at least according to the limited data sample of "everyone i know", a failed standard.

      Also, std::string largely works with the STL, which is a bit of a minefield to use becuase of the subtle incompatibilities between different STL implementations, and other C++ libraries besides the STL ones (that i have seen, at least) tend to implement their own sort of string class or just use cstrings.

    5. Re:Fragile Base Class problem (whining follows) by mcc · · Score: 1

      The fragile base class problem is only an issue for those using closed source libraries.

      It is an issue unless you have the source code to every single executable on your system, and access to that source code such that you can recompile any executable at will if a library it's based on changes. That means, basically, everyone, unless you're running Gentoo Linux and never install anything outside the package system. Even in the open source world, sometimes people like to distribute binaries.

      It is an issue because the fragile base class problem is something that every API you use was limited by having to work around unless they require you to open-source your program if you link against them. Not a lot of libraries do this. This trickles down to you in the form of worsened code quality.

      There is no way to get rid of the fragile basic class issue without making classes *much* slower and breaking the semantics of the C memory model.

      Oh, I'm sure there's a number of ways. Here's one I thought of just sitting here. It's probably not even the best one. It's a bit complex from the implementation point of view, but certainly doable:

      Delay linking. Rip off objective-c. For each compiled class, embed in the executable a table of "selectors" that lists as a string each variable and method and records its offset and public/private status. (Objective-c does something like this, except instead of calling functions it just passes the selector desired to a function called objc_msgsend(), which dynamically locates the desired hunk of code and executes it. This has a very large number of very very cool effects in terms of the dynamic abilities it gives objc, but it does impact speed, which would not be acceptable here, so a little bit more complexity is needed:) Since some people aren't comfortable with everyone knowing the names of the methods in their products, maybe there can be the option of saving the selector table as some sort of hash rather than as strings, or something.

      Also embed a table for each externally used class and each externally derived class (each compiled class which has somewhere in its inheritance heirarchy a class defined outside of the current executable) that records the exact location within the compiled executable of every instance where an instance variable or method of that class is referred to, and points to whichever entry in the selector table that is being referred to at that exact spot in code.

      Lastly, embed a table that for each externally linked or externally derived class that records what external libraries that class depends on or is found in, and what version the current executable was linked against.

      When the program runs-- hopefully the operating system could be made to handle this-- the program quickly checks the third (library) table above against the libraries on disk and checks to see if any of the libraries on disk are differently-versioned than the version the executable is expecting. If there's a difference, it runs through the set of second (uses of external classes) tables above, and alters the executable so that the offset for each instance variable and method is accurate according to the first (selector) tables located in the external classes.

      See? That neither breaks the C memory model nor has a speed impact (though i'm not convinced breaking the C memory model is altogether a bad thing). All it does is add metadata. It bloats executables, but not much more than templates or base-class 'padding' variables already do. It plays havoc with established systems for patches and virus protection, but that just means patch and virus protection systems would have to be rewritten. And the best part is, once those selector tables exist they can be used for the basis of class introspection and "does this class support this delegate method?" programming, like selectors do in Objective-C. It probably isn't the best solution, but it at least indicates solving the fragile base class problem in a static-method-binding language is *possible*, and that's what matters.

      (Actually.. now that i've written this post, i just realized, isn't Java statically method-bound yet free of the fragile base class problem? How does it do that?)

    6. Re:Fragile Base Class problem (whining follows) by be-fan · · Score: 1

      Your solution doesn't solve anything that COM or something similar doesn't. It only deals with method invocation. In particular, you're only dealing with interfaces and ignoring value semantics. For example, say I have a class Foo in library A. In the first version, Foo's private data consists of two integers. Now I derive a class, Bar, from Foo. Bar adds another integer to its private data. So now, sizeof(Foo) == sizeof(int) * 2, and sizeof(Bar) = sizeof(int) * 3. Now, what if Foo grows by an integer in the next version? Now, we've got sizeof(Foo) == sizeof(int) * 3, and sizeof(Bar) == sizeof(int) * 3. Now, if the client code creates an object of type Bar, it will create an object that doesn't have enough space for both Foo and Bar. There is the basic problem. C's memory model fundementally assumes that the layout of structures in memory doesn't change, to the point where it access all data members directly, does all sorts of inlining, etc. The only reason that stuff like COM works is because the client code doesn't ever inherit from the library code, and the client object is a dumb proxy that has no actual state. Java overcomes this by not assuming a static object layout.

      PS> There is a way to overcome the FBC problem, but it has a great deal of overhead. It basically involves treating all base classes like virtual bases. A derived class has a *pointer* to the base class, and instead of the compiler statically resolving methods to the base class implementation, it puts all the methods in the derived class. For methods that the derived class does not override, it simply forwards the request to the base class. This requires making all the methods in the class virtual, as well as adding an overhead of an extra pointer dereference to every access of the base class state. It also requires forbidding the compiler to inline any base class methods. It also requires forbidding the client code from manipulating class objects directly (say, malloc()'ing a byte buffer and using a placement new constructor). Java meets all these requirements, so it probably uses a mechanism very similar to this.

      --
      A deep unwavering belief is a sure sign you're missing something...
    7. Re:Fragile Base Class problem (whining follows) by ZamesC · · Score: 1
      It is an issue unless you have the source code to every single executable on your system, and access to that source code such that you can recompile any executable at will if a library it's based on changes. That means, basically, everyone, unless you're running Gentoo Linux and never install anything outside the package system. Even in the open source world, sometimes people like to distribute binaries.

      You are tremendously overstating the problem.

      It would only affect you if your base class is reissued in .OBJ form, and you choose to relink your code without recompiling it.

      If you recompile your code (with the new base class's .H files) and then relink with the new .OBJs, you'll be fine.

      If your vendor issues new .OBJs without issuing new .H files, they are dangerous, avoid them.

      (apologies for WINtel world terminology; Linuxheads should substitute ".Os" for ".OBJs" to understand).

    8. Re:Fragile Base Class problem (whining follows) by ZamesC · · Score: 1
      I've never met a single person who uses it?

      You should met a better class of programmers....

      I use it all the time. Even at my day job, where our legacy system uses a mixture of MFC's CString, ATL's _bstr_t and Rogue Wave's RWCString, we are moving to using std::string.

    9. Re:Fragile Base Class problem (whining follows) by mcc · · Score: 1

      My solution was trying to be effectively to relink the client executable when necessary. I was intending for accesses of instance variables to be tracked by selectors as well so that the memory location accessed in the client executable would change when the library classes changed (which isn't the same as relinking, i guess.. maybe i'm being unclear. blah.), though now that i think about it that really would be a tremendous amount of bloat.

      I had forgotten about function inlining, though. That breaks my suggestion and I'm not sure how to get around it. Oh well.

      There is a way to overcome the FBC problem [snip] Java meets all these requirements, so it probably uses a mechanism very similar to this.

      Okay, interesting.

      Anyway, I still suspect there's some way to overcome the FBC problem without scaring off the performance nazis, I'm just not sure what it would be :)

    10. Re:Fragile Base Class problem (whining follows) by MagPulse · · Score: 1
      How about component-based programming?

      In COM, once you publish an interface, you can plug in any object that supports it and it will work. The COM runtime will find the function pointers each time it loads the object so you can interchange them at will. And COM was made to be used with C++, though you want to use a template library to help you out like ATL. On UNIX you have XPCOM, and of course there's CORBA but I don't know anyone that uses that.

      .NET solves this problem too. I'm sure Java has something similar; I think JavaBeans are analagous to COM objects.

    11. Re:Fragile Base Class problem (whining follows) by Ben+Hutchings · · Score: 1

      Just learn the pimpl idiom already.

    12. Re:Fragile Base Class problem (whining follows) by Screaming+Lunatic · · Score: 1
      In what way do you not regard std::string as a standard string class?

      I'll ditto on that. I don't know what the original poster is talking about nor the company of programmers he associates with. But every C++ coder I know always uses std::string when it is appropriate, and const char* when you need a string of characters that you don't need to process.

  70. PLUG-IN LINKS Offtopic (go ahead mod my day) by Anonymous Coward · · Score: 0

    But when you submit a story, post a story, etc. Can you guys please alert folks about plug-in content. I hate ACROBAT.

  71. Useful for structs/unions by crow · · Score: 2, Interesting

    I've wanted this feature for many years, but mostly in the context of structs and unions.

    Suppose I have:

    struct foo {
    int i;
    struct bar {
    int j;
    int k;
    } s;
    } n;

    Now to reference j, I have to say n.s.j. But why not leave the s out so that I can just reference n.j?

    This becomes really useful is when you have a huge project and you decide that some element of a struct should be made into a union. Now you wouldn't have to change every reference throughout your project (or use #define to simulate the old naming).

    1. Re:Useful for structs/unions by Hard_Code · · Score: 1

      Please tell me you are not suggesting a core feature to save typing one reference...instead of dealing with the complexity (well, not complexity, verbosity really) in your program you are just pushing it into the language...

      --

      It's 10 PM. Do you know if you're un-American?
    2. Re:Useful for structs/unions by tc · · Score: 3, Insightful

      Until somebody adds a member called 'j' to foo, at which point your code still compiles fine, but is no longer doing what you intended.

    3. Re:Useful for structs/unions by crow · · Score: 2, Insightful

      Actually, if someone adds a member 'j' to foo, then there's no reason to assume it would compile fine. In fact, I would suggest that such a case should be specified as illegal, as it is essentially identical to having two elements of a structure with the same name.

    4. Re:Useful for structs/unions by crow · · Score: 1

      Yes, I am suggesting a core feature to improve code maintainability. I've seen many cases where elements in a structure have been moved into a substructure (sometimes with a union thrown in as well). So instead of x.y, you get x.a.b.y2. And instead of changing hundreds of references throughout the project, they #define y to be a.b.y2.

      The #define solution works, but is ugly, and breaks things if 'y' is used as a name elsewhere.

      Changing all the references is painful and obsoletes all the documentation (sometimes in printed books, as is the case with BSD).

    5. Re:Useful for structs/unions by Quietust · · Score: 2, Informative

      If you're using a Microsoft compiler, you can already do that; don't know if any other compilers have implemented that extension, though...

      --
      * Q
      P.S. If you don't get this note, let me know and I'll write you another.
    6. Re:Useful for structs/unions by codegen · · Score: 1

      In other words the standard abreviated structure reference
      that Cobol and PL/I have had since the 60s. Cobol
      and PL/I do not reqire you to specify the intermediate
      names when the name is unambiguous. When they are
      ambiguous then you have to specify some (but not all)
      of the intermediate names to disambiguate the case.

      There is nothing new under the sun - Aurther Conan Doyle.

      --
      Atlas stands on the earth and carries the celestial sphere on his shoulders.
    7. Re:Useful for structs/unions by Anonymous Coward · · Score: 0

      This is =so= wrong on so many levels. You must be a C programmer who has never had to maintain anything before. The "extra" syntax lets you, and those who follow you, know what you're trying to accomplish. In a big struct (why not a class?) the next programmer can waste a lot of time looking for j in n before realizing that, AHA!, it's actually in s. Bend over so I can kick your ass.

    8. Re:Useful for structs/unions by SamBeckett · · Score: 2, Informative

      My C++ compiler (g++ 3.1 20020420 (prerelease)) allows this (it is called anonymous unions, structures), etc.

      Thus I can do this:

      class Foo {
      union {
      char bob;
      struct {
      unsigned frank : 4;
      unsigned jim : 4;
      }
      };
      Foo bar;
      and access bob, frank and jim via: bar.bob, bar.frank and bar.jim. :-)

    9. Re:Useful for structs/unions by Anonymous Coward · · Score: 0

      I guess you meant :

      struct foo {
      int i;
      union bar {
      int j;
      int k;
      } s;
      } n;

      It wouldn't make any sense otherwise.
      That's my biggest reproach to C/C++ : the absence of true union types (ML-style). Classes may help replace them but still...

    10. Re:Useful for structs/unions by tc · · Score: 1

      Except that it's perfectly legal under the current standard. It would be thoroughly annoying to make it illegal, potentially breaking existing code, just to disambiguate a poorly-conceived convenience extension.

    11. Re:Useful for structs/unions by spitzak · · Score: 1
      No, it would only be illegal if the structure itself was unnamed. Since unnamed structures don't work right now, this will not be incompatable with anything.

      struct {int j; struct {int j;};} f; would be illegal because f.j is ambiguous.

      struct {int j; struct {ing j;} k;} f; would be legal. f.j is the first j, f.k.j is the second one.

    12. Re:Useful for structs/unions by be-fan · · Score: 1

      That would suck. That would introduce different scoping rules for named vs unnamed structures.

      --
      A deep unwavering belief is a sure sign you're missing something...
    13. Re:Useful for structs/unions by Anonymous Coward · · Score: 0

      Conan Doyle? I recommend you check your sources. Try Ecclesiastes.

    14. Re:Useful for structs/unions by Anonymous Coward · · Score: 0

      Actually, a better example would probably be:
      (assuming packed structures) union foo { int i; struct bar { signed char j[2]; unsigned short k; } m; } n; I'd certainly rather be able to do n.i and n.j[]/n.k than n.i and n.m.j[]/n.m.k
      As was mentioned earlier, some compilers will let you create anonymous structs (i.e. drop the 'm' from the above example) within other structs/unions - Microsoft compilers, apparently G++ 3.1 as well, perhaps others.

  72. I like by Hard_Code · · Score: 2, Interesting

    N1420 Class Namespaces
    N1428 Dynamic Library Support in C++

    Coming from Java (well, I did do a bit of introductory C++), one of the things that really bugs me, is the aesthetic of looking at the soup of classname::function implementation declarations. Class namespaces would clean this up considerably and make things much easier to read and more manageable (Java packages and classes are basically namespaces, and this concept confers very well). I also like the dynamic library support (another thing that is automatic in Java)...the worst thing is having to code native OS-specific macros, extern "C" DECLSPEC(dllexport) BLAH BLAH F'ING BLAH. Dynamic libraries are a ubiquitous concept and support should be built in. Leave it to the compiler to figure out what that actually *means* for a given OS. There is no performance benefit in making a human code this.

    Further library standardization would of course help...it really helps to have a standard library (even if it is not the BEST one), since it avoids balkenization, which makes skills truly portable ("C++ developer eh? well do you know how to use the Frobnitz Super Fantastic library? No? Shame."), and programs reusable (by other humans).

    --

    It's 10 PM. Do you know if you're un-American?
    1. Re:I like by Anonymous Coward · · Score: 0

      "Java developer, eh? Do you know how to work around the LiveConnect problems with the 1.4.0_01 plugin? No? Shame."

      As long as you're working on different platforms, you're going to run into implementation differences and bugs.

    2. Re:I like by Ricdude · · Score: 1

      No unix compiler I've ever used (Sun, HP, IRIX, Linux, DEC) ever required a dllexport/dllimport declaration. Windows used a unique dynamic linking mechanism that requires the programmer to tell the compiler what will be imported from a dynamic library, and what will be exported from the library currently being compiled. There's no reason, in today's enlightened day and age, that the compiler cannot figure this information our for itself during compilation and linking. Just one more case of Windows pushing more work onto its application programmers, instead of doing a little more work up front and making everyone's lives easier.

      --
      How's my programming? Call 1-800-DEV-NULL
    3. Re:I like by J.+Random+Software · · Score: 1

      It's a minor nuisance, but it prevents accidental dependence on non-published interfaces and implementation details of a shared library (especially in C, where "private" isn't an option). And symbols can be exported and imported via the linker without putting anything unportable in the C++ source.

    4. Re:I like by SpryGuy · · Score: 1

      That's because the Unix solution was to just export everything, even if you didn't want it or need it to be exposed. The Windows solution made more sense (only export those things that you want/need to export) but was more tedious.

      --

      - Spryguy
      There are three kinds of people in this world: those that can count and those that can't
    5. Re:I like by psykocrime · · Score: 1

      . I also like the dynamic library support (another thing that is automatic in Java)...the worst thing is having to code native OS-specific macros, extern "C" DECLSPEC(dllexport) BLAH BLAH F'ING BLAH. Dynamic libraries are a ubiquitous concept and support should be built in. Leave it to the compiler to figure out what that actually *means* for a given OS. There is no performance benefit in making a human code this.

      You are dead on, my friend. Truly portable dynamic class-loading would be a HUGE boon to C++.

      I've been a major C++ bigot for at least the last 10 years, but have recently been doing a lot of Java... and after spending all that time doing Java, I've found that there are a few things about it that I actually do like better, and that I wish C++ would adopt...

      1. a standardized system for loading classes at run-time.

      2. reflection

      3. A huge and largely very useful standard library.

      and I like exception handling just a little better in Java, mainly because there is no catch( ... ) and all exceptions derive from one class, ultimately... I like this, because it avoids the problem of catching an exception and then not having an exception object to get more information from. Having the exception object and it's printStackTrace() function in Java is, IMHO, a huge boon for debugging.

      --
      // TODO: Insert Cool Sig
    6. Re:I like by Ricdude · · Score: 1

      Any real linker will allow you to specify which symbols you want to export from a dynamic library. You can choose to export all of them if you wish, but you don't *have* to. If you feel the need to hide implementation details from the users, you can even drop undesired interface details from the headers used to access the library, or create a tie-style class (for c++) that only exposes the public interface for a class.

      Any programmer that uses, or even worse, relies on non-published interfaces deserves to maintain their code through several releases of supporting libraries. Then, maybe they'll learn the error of their ways...

      --
      How's my programming? Call 1-800-DEV-NULL
  73. C++0x is a Frankenstein Java by Anonymous Coward · · Score: 4, Interesting

    After working on the internals of the Std C++ library for several years I can honestly say that C++ is the biggest mess ever. The ANSI C++ committee is now trying to patch the language into a frankenstein version of Java.

    Unfortunately with Java 1.5, some of C++ is corrupting Java, mainly the completely academic confusing implementation of C++'s templates. Why not go for a more easier to understand concept of templates as implemented by languages such as Haskell?

    1. Re:C++0x is a Frankenstein Java by Q+Who · · Score: 1

      What is this? Completely unbacked up claims from someone working on "internals of Std C++ library", posted as AC. No details, some obscure Haskell reference...

      Moderators on crack...

    2. Re:C++0x is a Frankenstein Java by jbrandon · · Score: 1

      The ANSI C++ committee is now trying to patch the language into a frankenstein version of Java.

      Um, no. They aren't making it simgle inheritance, or 'everything is an object', or any other major differences. They're adding libraries, for the most part.

      Why not go for a more easier to understand concept of templates as implemented by languages such as Haskell?

      Because C++ templates are substantialy more powerful, and include things such as default arguments and instantiation with non-types. They also make simple methods for F-bounded polymorphism.

    3. Re:C++0x is a Frankenstein Java by Jagasian · · Score: 2, Insightful

      Ok, the mods must be crazy. This guy might be a troll, but... One thing I would like to point out is that Haskell is by far an "academic" language, if there ever was such a thing. Not sure why the parent poster uses that as an insult about Java's generics.

    4. Re:C++0x is a Frankenstein Java by Anonymous Coward · · Score: 1, Insightful

      Why not explain further. Why is this modded as interesting when he doesn't even give proper basis for his/her accusations.

      Troll. Troll. Tr...

    5. Re:C++0x is a Frankenstein Java by Anonymous Coward · · Score: 0

      The Java language is quite nice and simple (with the exception of the lack of enumerated types). But the API's and VM are nasty. I can't believe how badly designed the class file format and API's are, try reading what an "invokevirtual" bytecode has to do to locate and jump to a method - it makes me want to vomit (especially the attributes in the method_info structures! OMG it would be hard to design a language slower than Java).

  74. Re:Fake? by Anonymous Coward · · Score: 0


    Reports of my death have been greatly exaggerated.

    - Stephen King

  75. In other news, SCO owns Solaris extension Java by expro · · Score: 1

    In other news, SCO owns the Solaris extension known as Java, since it clearly is an extension to the Unix System V Operating System, having been incorporated there first.

    1. Re:In other news, SCO owns Solaris extension Java by Anonymous Coward · · Score: 0

      In addition, since SCO as a company has offices and employees in the physical world, the company will soon be advancing a claim on ownership of said physical world.

  76. Re:WHY DON'T THEY JUST CALL IT C++++ by Anonymous Coward · · Score: 0

    c += 2; ? = c + 2

  77. So does everyone else. by devphil · · Score: 4, Interesting


    The most popular suggestion, during the original standards process, was: every time someone proposes a new feature, they have to also propose an existing feature to be removed.

    The followup suggestion: every time someone proposes a new feature, they have to donate a kidney. This ensures that proposals will be given serious thought, and that a serious idiot can only propose, at worst, two extensions.

    No, I'm not joking. Those were some of the suggestions that received rare unanamous agreement.

    Seriously, everyone on the committee, from Stroustrup and Koenig on out, agrees that the language is too complicated. They even said so before it was standardized. But...

    Let's hear your suggestions on which stuff should be removed. Remember that no matter what you choose, people somewhere are currently using it, and you will break their code. No matter what you change, it will cause incompatabilities, which future generations of /. will then bitch and moan about.

    Also, since compiler vendors don't like pissing off their customers, they can't really completely remove stuff even when the standard says it's okay.

    --
    You cannot apply a technological solution to a sociological problem. (Edwards' Law)
    1. Re:So does everyone else. by starling · · Score: 1, Insightful

      Let's hear your suggestions on which stuff should be removed.

      Default parameters and function overloading. Both encourage lazy programming and, more importantly, hide bugs.

    2. Re:So does everyone else. by nytes · · Score: 1
      Default parameters and function overloading.

      But you remove both, then you've broken (the first example that pops into mind):
      string c1;
      string c2("abcde");
      because there must either be an overloaded ctor or a default parameter for the ctor.

      --
      -- I have monkeys in my pants.
    3. Re:So does everyone else. by starling · · Score: 1

      I think you missed my point. There's no need for an overloaded ctor *or* a default parameter. And objects are just glorified structs with function pointers bloating them up.

      Sodit, I'm going back to C. Or maybe assembler.

    4. Re:So does everyone else. by alexo · · Score: 1

      > Let's hear your suggestions on which stuff should be removed.

      1. export
      2. exception specifications

    5. Re:So does everyone else. by Anonymous Coward · · Score: 0

      Ahhh. I get it - a luddite. :-)

    6. Re:So does everyone else. by zizzo · · Score: 2, Funny

      If I propose you remove operator overloading, can I get my kidney back?

    7. Re:So does everyone else. by buckinm · · Score: 2, Funny

      If I propose you remove operator overloading, can I get my kidney back?

      Actually, you get an extra colon, but you should be able to cast it to any organ you like.

      --
      This isn't any ordinary darkness. It's advanced darkness.
    8. Re:So does everyone else. by StrawberryFrog · · Score: 1

      Default parameters and function overloading. Both encourage lazy programming and, more importantly, hide bugs.

      No they don't. You don't provide any justifcation for your silly assertion, so neither shall I. But neverthess that is my experience.

      These features allow a way to add parameters to an oft-used without breaking existing code.

      If anything in C++ is syntactic sugar that hides bugs, it is operator overloading. I still remember a bug that hid in plain sight for days because some bright spark had overrdden the deref operator to return the wrong level of indirection. Ick.

      --

      My Karma: ran over your Dogma
      StrawberryFrog

    9. Re:So does everyone else. by KalvinB · · Score: 1

      So don't use them.

      The idea of a language shouldn't be to force people to code the way you think they should code.

      Ben

    10. Re:So does everyone else. by pyrrho · · Score: 1

      >Let's hear your suggestions on which stuff should be removed. Remember that no matter what you choose, people somewhere are currently using it, and you will break their code.

      oh yeah, the hell with them if they don't know what's good for them. They have no principles. The are unprincipled... and condemned!

      not really. I rarely throw away a tool, I just let it sit in the toolbox or move it to a separate box in the garage so I don't carry it around all the time. But rarely do I throw one away.

      --

      -pyrrho

    11. Re:So does everyone else. by starling · · Score: 1

      These features allow a way to add parameters to an oft-used without breaking existing code.

      Exactly - if you're too lazy to modify the code then C++ lets you get away with it. Ugh.

      If anything in C++ is syntactic sugar that hides bugs, it is operator overloading

      Good point, let's add them to the list. For example, overloading "" was a truly, mindbogglingly stupid idea.

      --
      Tony

    12. Re:So does everyone else. by sig+cop · · Score: 0

      operator overloading is not just sugar - it facilitates generic programming especially when dealing with user defined types AND native types.

    13. Re:So does everyone else. by starling · · Score: 1

      And while I'm at it I'd like a word with the people who designed html and mangled up the "<<" in my previous post...

    14. Re:So does everyone else. by starling · · Score: 1

      Only on Fridays ;)

    15. Re:So does everyone else. by Q+Who · · Score: 1

      Haha, you are either a troll, or don't know C++.

    16. Re:So does everyone else. by starling · · Score: 1

      I code C++ for a living. Be very afraid.

    17. Re:So does everyone else. by Anonymous Coward · · Score: 0

      And while I'm at it I'd like a word with the people who designed html and mangled up the "<<" in my previous post...

      Yeah. If only Slashdot offered some way to preview the text of your post before you submitted it.

      Moron.

    18. Re:So does everyone else. by Cuthalion · · Score: 1

      Opererator overloading is great for generics. Because then stuff can work on built-ins and user defined types the same. Because operator(const T &, const T&), and so on, all without writing two versions of each template.

      --
      Trees can't go dancing
      So do them a big favor
      Pretend dancing stinks!
    19. Re:So does everyone else. by StrawberryFrog · · Score: 1

      Exactly - if you're too lazy to modify the code then C++ lets you get away with it. Ugh.

      Uhh.. do you work in your own private universe? What I mean is, you don't interface with other people/company/toolkit's code much do you?

      --

      My Karma: ran over your Dogma
      StrawberryFrog

    20. Re:So does everyone else. by Paradise+Pete · · Score: 1

      The first post made me laugh, then you topped him. Yet neither one has been modded Funny. Maybe you needed to mention Soviet Russia or something.

    21. Re:So does everyone else. by Q+Who · · Score: 1

      Man, now, that's scary. Stop it!

    22. Re:So does everyone else. by nathanh · · Score: 1
      Let's hear your suggestions on which stuff should be removed.

      Remove pass-by-reference. I'm not joking. It's the most useless feature of the language. Plus so many people pass-by-reference for "efficiency" over pass-by-value then forget to cast it with const, so the compiler generates extremely inefficient code. If you really need pass-by-reference then use a pointer, just like C. Pass-by-reference is an abomination.

      Remember that no matter what you choose, people somewhere are currently using it, and you will break their code.

      Tough. I'd say that C++ is a Frankenstein's monster, but even that monster had the proper number of limbs. C++ has 17 arms and 29 legs and 4 heads. Unfortunately using arm number 15 at the same time as leg number 6 causes head number 2 to leak memory. It's a stupid language. Far too complex for mortal humans to grok. Cutting out deadwood is necessary to make it useful again.

    23. Re:So does everyone else. by Jeremi · · Score: 1
      Exactly - if you're too lazy to modify the code then C++ lets you get away with it. Ugh.


      My library is used (in source code form) by N other people, many of which have minimal contact with me. It's not a question of whether I'm too lazy to modify the code (global search and replace is easy), so much as I dislike breaking other people's code.

      --


      I don't care if it's 90,000 hectares. That lake was not my doing.
    24. Re:So does everyone else. by be-fan · · Score: 1

      On the contrary. Pass by reference is wonderful. You should never use pointers unless you need to change what the object points to. Use a const reference (writing foo const& is ingrained into long term C++ programmers) or passing parameters or a regular reference when you need to modify the value. Using references and the STL, C++ almost feels like a garbage collected language. In fact, its entirely possible (and natural) to write an entire program that never uses new/delete or any pointers at all.

      --
      A deep unwavering belief is a sure sign you're missing something...
    25. Re:So does everyone else. by Oggust · · Score: 1
      export, mutable and template templates in STL. removing export and the creeping horror that is mutable needs no further justification. Template templates are too complex for anyone to really use.

      Oh yeah, and kill const_cast too.

      /August.

      --
      "An object declared as type _Bool is large enough to store the values 0 and 1." -- 6.1.2.5, C99 standard.
  78. Re:Whatever. by AssFace · · Score: 2, Funny

    everyone knows that JavaScript is where its at.

    I do all my cluster number crunching in JavaScript.

    pure speed baby

    --

    There are some odd things afoot now, in the Villa Straylight.
  79. This will help out companies by Necroman · · Score: 3, Interesting

    If this standard does go through, aht GNU supports it via gcc or what have you, this will help companies in a big way.

    The company I worked for used to write our software in C++, but moved over to java 3 or 4 years ago for the cross platform abaility of this. There are so many core parts of a program that are system dependent, that supporting 8 different operating systems in C++ is impossible without a standard library of some sorts. Add a standard socket structure will be very nice, and most OSs have very different ways of handling this. Threading is also the other huge issue with crossplatform, there is near zero standard on out threading works in C++.

    The one thing that the new C++ proposal is missing is a standard widget/windowing commands. But there is no good way to make standard libraries for something like that, the best if to create a general class to create and control widgets, then write the system specific code for each OS you want it to run on.

    It's something I'm looking forward to.

    --
    Its not what it is, its something else.
    1. Re:This will help out companies by mstorer3772 · · Score: 2, Informative

      Boost (www.boost.org) has crossplatform libraries for both sockets and threads.

      You're welcome. ;)

      --
      Fooz Meister
    2. Re:This will help out companies by Anonymous Coward · · Score: 0

      Boost.Socket is still a work in progress:

      http://www.crystalclearsoftware.com/cgi-bin/boos t_ wiki/wiki.pl?BoostSocket/Tasks

    3. Re:This will help out companies by Anonymous Coward · · Score: 0

      > supporting 8 different operating systems in C++

      But if it weren't for Win CeMeNt nonsense you would only be supporting, what? 3 platforms?

    4. Re:This will help out companies by GooberToo · · Score: 1

      Sounds like you guys need to look at ACE. Multiple platform and implements all sorts of design patterns!

      Good Stuff!

    5. Re:This will help out companies by Q+Who · · Score: 2, Informative

      Sounds like you guys need to look at ACE. Multiple platform and implements all sorts of design patterns!

      du -ks /usr/local/ACE_wrappers-5.2.4
      652640 /usr/local/ACE_wrappers-5.2.4

      Just to warn the innocent... (Yes, I know that one can selectively use features, but this gives a perspective, don't you think?)

  80. NULL pointer dereference by virtigex · · Score: 2, Funny

    Obviously this is named after the long tradition in C and C++ of null pointer dereferencing. No C or C++ program is complete without it. The version after this one will be called C++BUFFEROVERFLOWWWWWWWWWWWWWWWWWWWWWWWWWWWWW...

    1. Re:NULL pointer dereference by Anonymous Coward · · Score: 0

      R O F L M A O!!!!!!!!!!!

  81. Re:Whatever. by Tumbleweed · · Score: 1

    > I and the rest of the world that has realized the benefits of object-oriented programming will move on to that which is superior.

    You're talking about Objective-C, right?

  82. Noooooooo! by timeOday · · Score: 5, Insightful

    In practice, C++ is finally getting to the point where various compilers accept the same code. That after 15 years or so. Now they want to shake it up again?

    1. Re:Noooooooo! by be-fan · · Score: 4, Insightful

      Its only been about 5 years since C++ 98 was standardized. And GCC has been very complient for about a year now, so it took 4 years for complient compilers to come out. That's really not *that* bad, considering that the latest push for complience was driven by the new wave of "Modern C++" techniques, which surfaced relatively recently. Further, a lot of the new proposals use pre-existing solutions (the Boost libraries are a big help here) and all the code that was added for template support seems to have some reusability value. See Vandervoode's comments about his C++ metacode extension, and how relativley easy it was to implement in the EDG C++ front-end, thanks to all the existing infrastructure.

      --
      A deep unwavering belief is a sure sign you're missing something...
    2. Re:Noooooooo! by jdennett · · Score: 1

      There will be much less change this time around; C++ has a standard now, and the standards committee, unsurprisingly, is largely composed of people who care about the value of a stable standard.

      Many of the changes that are made will be in the library, not affecting compilers. Library changes tend to be "cheaper" in the library implementations are more portable and less user code is broken.

      Changes to the core language are much harder to get past the committee. Apart from anything else there are fewer committee members working in this area.

      Compared the stability of C++ to the rate of evolution of (say) Java, and you'll maybe see that we do care about the real world.

    3. Re:Noooooooo! by Anonymous Coward · · Score: 0

      It's a plot so developers will have to learn a new language every few years, and there'll be annoying syntax questions at job interviews.

    4. Re:Noooooooo! by zCyl · · Score: 1

      and there'll be annoying syntax questions at job interviews

      If you get asked an annoying syntax question at a job interview to which you don't know the answer, simply respond "I don't know, but I know how to look it up. Programming is a thought process, not memorization of syntax eccentricities."

    5. Re:Noooooooo! by be-fan · · Score: 1

      I don't do interviews, but I'd be wary of people who have problems with C++ syntax. The language is still small enough that you should be able to hold the whole syntax, as well as most of the features in your head. Its rather hard to write code when you're not fluent in the language.

      --
      A deep unwavering belief is a sure sign you're missing something...
    6. Re:Noooooooo! by Nynaeve · · Score: 1

      I don't know, but I know how to look it up. Programming is a thought process, not memorization of syntax eccentricities.
      Is the syntax question annoying because it's about syntax or because you don't know the answer?
      ...and the job goes to...someone who could answer the question. Maybe I don't thoroughly understand your statement, but my thought process constantly involves "syntax eccentricities."
      When I interviewed for my current job position, I was give a brief syntax/data structures exam on paper. No computer, not even a text editor.
      Maybe you think syntax questions are annoying, but I got a 50% pay increase out of it!

    7. Re:Noooooooo! by user2048 · · Score: 1
      ...GCC has been very complient for about a year now, so it took 4 years for complient compilers to come out...

      Is it possible that there were compliant compilers before GCC? And that GCC was late at reaching compliance?

  83. Isoiec-JetSeeWonsc-tutuwig-tuwan by Anonymous Coward · · Score: 1, Funny

    Phonetically, Isoiec-Jetsee-Wonsc-Tutu-Wig-Tuwan sounds like a Jedi name. Or a droid. Maybe a Jedi droid. Artoo's brother.

  84. First things first... by SugoiMonkey · · Score: 1

    ...try to say it once.

  85. If the differece beween C and C++ ..... by Conspiracy_Of_Doves · · Score: 2, Funny

    is that with C++ it's harder to shoot yourself in the foot, but when you do you end up blowing your whole leg off... With C++0x will it be nearly impossible, but when it does happen you end up blowing up the whole city?

    1. Re:If the differece beween C and C++ ..... by tommck · · Score: 1

      At least appropriately attribute Bjarne with that quote!

      --
      ---- It puts the lotion on its skin or else it gets the hose again. It does this whenever it's told.
    2. Re:If the differece beween C and C++ ..... by Conspiracy_Of_Doves · · Score: 1

      The joke assumes that the reader already knows that he said it. If they don't know, they shouldn't be reading /.

    3. Re:If the differece beween C and C++ ..... by maxume · · Score: 1

      I disagree. I am more of the opinion that maybe you shouldn't be reading slashdot, or at the very least, not posting.

      --
      Nerd rage is the funniest rage.
  86. Late? As in dead? (nt) by Anonymous Coward · · Score: 0

    Not a Troll.

  87. A few suggestions by Anonymous Coward · · Score: 1, Interesting

    I'll ignore the mass of amazingly redundant and unfunny comments made about "C++0x."

    The PDF file shows that they're committed to killing some of the idiosyncrasies of the language. I could list a lot of them, but here are a few that stick out at this moment in time.

    What would be most beneficial is if the . operator worked in the same context the arrow operator did. It is a pain to have to convert every usage of it over if you switch a reference to a pointer. The arrow operator could just be a deprecated operator for C compatibility.

    Also, references seem to be ill conceived. The worst part is they can't be stored in STL structures because there is (currently) no such thing as a double reference. References should only be allowed in function argument lists.

    1. Re:A few suggestions by Pxtl · · Score: 1

      There are other possible conventions that would work too. Actually, when you get into overriding dereference, then there is a big difference between the arrow operator and the . operator.

      I'd almost think multiple dots would be the way to go.

      For example
      c.d
      (*c).d == c->d == c..d
      (**c).d == (*c)->d == c...d

      Either that or a high-precedence version of the rereference operator. Having the dereference operator lower precedence then the member operator is what causes those ungodly messes of brackets.

      Notice that the arrow operator kinda barfs on pointers to pointers (and I use them a lot - particularly when doing strange things with STL). Thats one of the things I have a big problem with in C++ - the friggin arrow operator is an obvious kludge.

      The STL rears an ugly head of many problems - the fact that an object must be copy-perfect is a good example, making putting auto_ptr's into it impossible, no matter how nice it would be.

      My biggest problem is the member operator - while its nice to have the difference between classes and instances plainly visible, it makes using namespaces fugly. You either fully import the namespace (thus defeating the entire purpose of having a namespace) or you use the nasty ::operator.

      In java, I got used to deeply nesting my libraries for good organization. Yes, it.was.long.to.my.function but it was very readable, and the function could be aliased if you needed it (good feature). When I code in C++ it becomes NPyTp::NGizmo::New which is such a pain, and ugly. There's a place I'd like a simpler operator.

    2. Re:A few suggestions by ray-auch · · Score: 1

      STL and auto_ptrs is not a problem with STL (or auto_ptr really) - you are trying to use the wrong tool for the job.

      auto_ptr is designed for "resource acquisition is initialization" - specifically not for copying around (it is not a "smart pointer" and is not supposed to be). stl containers are designed for copying things in and out of - the two things therefore do not go together _by design_.

      if you want to put pointers in stl containers you can (and manage the lifetime yourself), if you want to put objects-managing-pointers in, you can - just use boost or one of the many other smart pointer implementations (as simple to use as auto_ptr, with a little (necessary) extra overhead).

    3. Re:A few suggestions by sebmol · · Score: 1

      References have many good uses outside of argument lists. I wouldn't want to miss them.

      --
      "Light is faster than sound." - "Is that why people tend to look bright until you hear them speak?"
  88. Re:What C++ really needs to do by slick_rick · · Score: 4, Insightful
    Delphi stomp who what? I think you mean VB an Java, not Delphi. ( I started with Delphi and remember it fondly, but you don't run across it much in the business world and never have). The reason VB succeeded is obvious, however the Java smash is more subtle. The real key in the enterprise is databases. There is no "one true way" of accessing a database through C++ (ALA JDBC or whatever model VB is using these days, it was ADO when I last had a VB contract.)


    The IDEs do also cater to the business community, probably why you don't see more Perl. The fact is "business software" is usually just glue, and Perl/Python/Java/VB/tcl will always be better glue then C++, because they were DESIGNED to be glue and C++ was designed to be the bricks and mortar.


    What I would really like to see in C++ would be compile-time exception enforcement ALA Java. I mean Jesus, when you are trying to work with a class library they can't even document what functions may throw what, how the hell are you supposed to write robust code? In Java this documentation comes for free when you write the function, and is forced to be correct by the compiler.

    --
    apt-get install redhat please god - Me (take it easy, I love Debian)
  89. TIME TO RETIRE C++ by Anonymous Coward · · Score: 5, Funny

    Hello Gentlemen,

    I'm a first year programming student at an Ivy League school and I've
    just finished my Visual Basic classes. This term I'll be moving onto
    C++. However I've noticed some issues with C++ that I'd like to
    discuss with the rest of the programming community. Please do not
    think of me as being technically ignorant. In addition to VB, I am
    very skilled at HTML programming, one of the most challenging
    languages out there!

    C++ is based on a concept known as Object Oriented Programming. In
    this style of programming (also known as OOPS in the coding community)
    a programmer builds "objects" or "glasses" out of his code, and then
    manipulates these "glasses". Since I'm assuming that you, dear reader,
    are as skilled at programming as I am, I'll skip further explanation
    of these "glasses".

    Please allow me to make a brief aside here and discuss the origins C++
    for a moment. My research shows that this language is one of the
    oldest languages in existence, pre-dating even assembly! It was
    created in the early 70s when AT&T began looking for a new language to
    write BSD, its Unix Operation System (later on, other companies would
    "borrow" the BSD source code to build both Solaris and Linux!)
    Interestingly, the name C++ is a pun by the creator of the language.
    When the first beta was released, it was remarked that the language
    would be graded as a C+, because of how hideously complex and unwieldy
    it was. The extra plus was tacked on during a later release when some
    of these issues were fixed. The language would still be graded a C,
    but it was the highest C possible! Truly a clever name for this
    language.

    Back to the topic on hand, I feel that C++ - despite its flaws - has
    been a very valuable tool to the world of computers. Unfortunately
    its starting to show its age, and I feel that it should be
    retired, as COBOL, ADA and Smalltalk seem to have been. Recently I've
    become acquainted with another language that's quite recently been
    developed. Its one that promises to greatly simplify programming. This
    new language is called C.

    Although syntactically borrowing a great deal from its predecessor
    C++, C greatly simplifies things (thus its name, which hints at its
    simpler nature by striping off the clunky double-pluses.) Its biggest
    strength is that it abandons an OOPS-style of programming. No more
    awkward "objects" or "glasses". Instead C uses what are called
    structs. Vaguely similar to a C++ "glass", a struct does away with
    anachronisms like inheritance, namespaces and the whole
    private/public/protected/friend access issues of its variables and
    routines. By freeing the programmer from the requirement to juggle all
    these issues, the coder can focus on implementing his algorithm and
    rapidly developing his application.

    While C lacks the speed and robustness of C++, I think these are petty
    issues. Given the speed of modern computers, the relative sluggishness
    of C shouldn't be an issue. Robustness and stability will occur as C
    becomes more pervasive amongst the programming community and it
    becomes more fine-tuned. Eventually C should have stability rivaling
    that of C++.

    I'm hoping to see C adopted as the de facto standard of programming.
    Based on what I've learned of this language, the future seems very
    bright indeed for C! Eventually, many years from now, perhaps we'll
    even see an operating system coded in this language.

    Thank you for your time. Your feedback is greatly appreciated.

    Egg Troll

    1. Re:TIME TO RETIRE C++ by IWannaBeAnAC · · Score: 1

      Sorry, I think you overplayed it a bit, and didn't leave enough remenants of reality to argue over. Even on first glance, it is 100% troll.

    2. Re:TIME TO RETIRE C++ by ArsonSmith · · Score: 0

      You, Sir, have been GROSSLY miss informed. The term is Class not Glass.

      Everything else looks good though.

      --
      Paying taxes to buy civilization is like paying a hooker to buy love.
    3. Re:TIME TO RETIRE C++ by Anonymous Coward · · Score: 0

      YHBT
      YHL
      HAND

    4. Re:TIME TO RETIRE C++ by Anonymous Coward · · Score: 0

      WTF? HDNL!

    5. Re:TIME TO RETIRE C++ by Anonymous Coward · · Score: 0

      No, the reason it succeeds so brilliantly is the phenomenon of "troll camp", which is wildly popular on ./

      -jn

    6. Re:TIME TO RETIRE C++ by Anonymous Coward · · Score: 0

      I truly Hope that this post is a joke. Because if it is not, you my friend looks like are reading your "Ivy League" textbooks upside down.

    7. Re:TIME TO RETIRE C++ by Anonymous Coward · · Score: 0

      Britt, you're such a fucking tool!

    8. Re:TIME TO RETIRE C++ by shish · · Score: 1

      Maybe you guys didn't notice - IT'S A JOKE.

      --
      I mod down anyone who says "I will be modded down for this", regardless of the rest of their comment
    9. Re:TIME TO RETIRE C++ by Anonymous Coward · · Score: 0

      Say Pinhead, you don't think the "everything else looks good" is a tip-off that he got the joke?

  90. It's really quite simple... by Anonymous Coward · · Score: 0

    Overall goals
    Make C++ a better language for systems
    programming and library building
    - Rather than providing specialized facilities for a particular sub-community
    (e.g. numeric computation or Windows application development)
    Make C++ easier to teach and learn


    I see exactly what they need to do in order to accomplish their objectives: make C++ into Java.

    1. Re:It's really quite simple... by IWannaBeAnAC · · Score: 1

      Since when was Java any good for systems programming?

  91. Objective C!! by Anonymous Coward · · Score: 0

    Okay, well, maybe that's more like C-=0.5, but it's still sorta cool.

  92. D already exists by Anonymous Coward · · Score: 0

    I have yet to see this mentioned (which surprised me)

    http://www.digitalmars.com/d/

  93. so then what does C++ + ObejctiveC=? by linuxislandsucks · · Score: 0, Flamebait

    so then what does C++ + ObjectiveC=?

    a big mess that still does not compare to Java..

    --
    Don't Tread on OpenSource
    1. Re:so then what does C++ + ObejctiveC=? by Anonymous Coward · · Score: 0
      Oh yeah, let's all worship Java, the piece of crap language that won't even get generics until next year.

      Java:

      ArrayList al = new ArrayList();
      al.add(new Integer(4));
      al.add(new Integer(2));
      System.out.println( ((Integer)al.get(0)) + ((Integer)al.get(1)) );
      C++:
      vector<int> v;
      v.push_back(4);
      v.push_back(2);
      cout << v[0]+v[1] << endl;
      And let's not talk about the craptastic IDEs Java has. Oh wait, I'm sure you're one of those weenies that uses vi to do your coding in right. And jdb for debugging.
    2. Re:so then what does C++ + ObejctiveC=? by Anonymous Coward · · Score: 0

      Or in a ancient language,

      int al[2] = { 4, 2 };
      printf("%d %d\n", al[0], al[1]);

      Enjoy,

  94. A new version of language or filter-busting spam? by PDHoss · · Score: 3, Funny

    T33N 8abes ready for your h0t C++0x !!!

    --
    ======================================
    Writers get in shape by pumping irony.
  95. Re:Whatever. by Anonymous Coward · · Score: 0

    I do not like C++ in terms of the performance and memory impact it infers
    You have only yourself to be mad at. You are responsible for the performance and memory impact. Compiling C code in C++ doesn't hurt a thing.

    C++ lets you choose whether you want to pay the cost of a feature or make do without it. Don't want virtual function table overhead? Don't mark anything virtual! Don't want RTTI? Don't enable it!

    IMO this is far superior to many other languages forcing these choices on you.

  96. Improved C++? by Anonymous Coward · · Score: 0

    It's called Objective-C

    1. Re:Improved C++? by cosmo7 · · Score: 1

      Objective C is a beautiful language for sure. The square brackets kind of freak you out at first, but the way you can do Smalltalk-style statements make it totally worthwhile (and readable). For example:

      NSImage * anImage = [[[NSImage alloc] initWithSize: [anObject getSize]] retain];

  97. COM revisited? by expro · · Score: 1

    Yuck! Back to the future, we find ourselves chasing stale object graphs, like in COM. Or have they somehow made them safer? Refcounting was a Microsoft innovation I clearly could have done without.

    1. Re:COM revisited? by David+Gould · · Score: 1


      Refcounting was a Microsoft innovation...

      Sigh.

      --
      David Gould
      main(i){putchar(340056100>>(i-1)*5&31|!!(i<6)<< 6)&&main(++i);}
  98. Just call it E. by robbo · · Score: 3, Funny

    If C++==D then the next gen should be E. Actually, if we count pre and post ISO standards, we've moved on to F, which is a fine letter, imho. F, of course will add the exponentiation operator **, so we can compute F**k. ;-)

    --
    So long, and thanks for all the Phish
    1. Re:Just call it E. by jonm · · Score: 1

      But Microsoft have already beaten us to it with
      'F#' [research.microsoft.com]...

    2. Re:Just call it E. by bestguruever · · Score: 1

      Given that c was based on the language e, this would be a strange regression

      --
      if you think this is bad, you should have seen my last sig
    3. Re:Just call it E. by mystran · · Score: 2, Funny

      Actually, to make the new F language worthy of being successor of C++, it's probably better idea to overload ^ to be the exponentiation operator, so as to confuce everybody.

      --
      Software should be free as in speech, but if we also get some free beer, all the better.
    4. Re:Just call it E. by calethix · · Score: 1

      Just call it ++, no bloody C, D or E.

      (that's a trek reference for anyone that doesn't catch it)

    5. Re:Just call it E. by good-n-nappy · · Score: 1

      Maybe we should just move to the confusing world of bra sizes. Could lead to some really awful pickup lines for geeks... "I'm very familiar with DD"

      --
      Never underestimate the power of fiber.
    6. Re:Just call it E. by canajin56 · · Score: 1

      C was based on B, which was based on BCPL (Basic CPL), which itself was a simplified version of CPL, which was a language based loosely on Algol 60, but highly bloated. BCPL was supposed to be a dumbed down version of CPL that they could write the first CPL compiler in without having to use assembly, but it ended up being more popular.

      --
      ASCII stupid question, get a stupid ANSI
    7. Re:Just call it E. by MrEd · · Score: 1
      I can't take anything seriously that has a ==D in it.....


      Penis bird?

      --

      Wah!

    8. Re:Just call it E. by TheRaven64 · · Score: 1

      Actually C++ is not D, D is another language which tries to be a bit less broken than C++. Unfortunately, while D looks like a nice language it also looks as though it may be impossible to write a compiler for it... (After over 3 years in development the compiler still doesn't implement the whole language)

      --
      I am TheRaven on Soylent News
    9. Re:Just call it E. by awol · · Score: 1

      The problem is that the name C++ already contains the uncertainty of incrementation. IIRC correctly, the issue was that since C was a successor to the language B which in turn was the successor to BCPL, the tough call was whether to go for D (as in ABCD) or P (as in BCPL) or something all together different. So the hack was why decide, lets just make it C++ and avoid the whole problem.

      As a result, to really go forward with the lame humour, I would recommend *C, starsee, or what C points to.

      --
      "The first thing to do when you find yourself in a hole is stop digging."
    10. Re:Just call it E. by Anonymous Coward · · Score: 0

      Dear Diary,

      Today I spotted a trek reference and smiled, and showed it to my friends. They called me a freak, and my shrink said my star trek obsession might be a escapist mindscape induced by an extreme subconcious desire to become a real jedi. I was forced to spend several hours in a straight jacket after telling him that jedis aren't in star trek.

  99. Help pleese by Anonymous Coward · · Score: 0

    Any girl like sex there? I need girl like sex!

  100. Re:What C++ really needs to do by 8282now · · Score: 1

    ...My guess would be that the good programming langage wouldn't be the one with no safe net (C++) or the one with safe nets that cripple the performance (C#), but the one where you can choose the degree of safety you need, and can play with it at will.

    So... that would be what... c++ in the hands of an experienced programmer then?
    j/k
    Really though, as Stroustrup states in ch. 2 of his The C++ Programming Language book,
    "C++ is a general-purpose programming language with a bias towards systems programming ..." (emphasis mine)

    So it might not be the tool you're looking for it to be. But for it's intended purpose, serves quite well.

  101. Re:SCO owns nothing but C++rap by bucky0 · · Score: 1

    It doesnt make much sense that Rambus could patent some technologies in RDRAM, considering it was a standard and all... /sarcasm

    --

    -Bucky
  102. Cool by be-fan · · Score: 4, Interesting

    Modern C++ really is a cool language. Its hardly clean, and its a big beast to learn, but (IMHO) it allows a great deal of abstraction without sacrificing much (if any) performance. Personally, I'd like to see the following features in C++ 0x.

    1) Metafunctions. Like Lisp macros, they allow code-generation at compile time. They're less flexible, because they don't allow access to the AST, but they're much better than the current template-metaprogramming kludge.
    2) Lambdas. Even if we don't get true lambdas, with continuations and closures, but I'd like to see some sort of anonymous functions. The STL desperately requires it. Overall, I'd like to see more functional stuff get into the language. Unlike many of the other features discussed, lambdas and higher order functions really need language-level support to work well.
    3) Type inference. There is a proposal to allow a new use of the auto keyword like such:
    auto x = new int;
    The compiler will automatically detect that 'x' should be an int*. I've wanted this feature from the minute I saw stuff like:
    int* i = new int;
    Its so redundant! I'm surprised that Java (whose simple semantics would make type inference much easier) still makes you do stuff like:
    foo i = new foo;
    An additional motiviation is that:
    vector::iterator i = vec.begin()
    can be shortened to:
    auto i = vec.begin();
    C++ is seriously eating into the horizontal space, thanks to namespaces and nested typedefs and whatnot, and type inference would go a long way in alleviating some of that pain.

    The nice thing about these features is they keep with C++'s philosophy. Most of the complexity here is in the compiler --- there is no overhead in the generated code.

    --
    A deep unwavering belief is a sure sign you're missing something...
    1. Re:Cool by exp(pi*sqrt(163)) · · Score: 1
      int* i = new int;
      Yes, we have redundancy. There are two obvious ways to go to remove that redundancy. You propose one. The other is interesting too: allow overloading based on return type. Then int a = f(b,c), say, would actually be making non-redundant use of the type of a.
      --
      Doesn't it make you feel good to know that our freedoms are protected by politicans, lawyers and journalists.
    2. Re:Cool by be-fan · · Score: 1

      I don't see how that helps either of the examples I gave above, anyway. Normally, I wouldn't bitch about a little issue like that, I'd just go and use std::for_each instead of bothering with explicit iterators. However, C++ doesn't have lambdas, so std::for_each is sometimes a lot more trouble than its worth!

      --
      A deep unwavering belief is a sure sign you're missing something...
    3. Re:Cool by truth_revealed · · Score: 1

      Amen, brother. Anything that reduces the amount of needless typing in C++ programs is welcome. I'd only add C++ reflection to your wishlist since every library rolls their own scheme based on wacky macros or external pre-processor programs anyway. Language purists who are against reflection have never coded large systems in the real world.

    4. Re:Cool by exp(pi*sqrt(163)) · · Score: 1
      I think we're talking about cross purposes! I'm talking about the inherent redundancy in the repeated use of 'int' in a statement like 'int *a = new int'. I'm proposing making that statement non-reduandant by actually having the first reference to 'int' being meaningful in that the right hand side is told that it is supposed to be returning an int. A few computer languages have this facility.

      Incidentally, see >a href="http://www.cc.gatech.edu/~yannis/fc++/">this for just how close to having lambdas C++ is. That's Haskell code being ported straight to C++ including almost the entire standard prelude.

      --
      Doesn't it make you feel good to know that our freedoms are protected by politicans, lawyers and journalists.
    5. Re:Cool by X · · Score: 1
      You might want to check out Boost.
      1. The boost guys have developed MPL, which really does seem to work reasonably well.
      2. The boost lambda library, if you can get it to compile, gives you most of what you'd want with regard to lambdas.
      3. You can sort of use the "any" stuff in the boost library to accomplish this. Honestly though, with C++'s already complex semantics, I would not want to add type inferencing. I suspect things would get FAR too unpredictable.
      --
      sigs are a waste of space
    6. Re:Cool by El+Cabri · · Score: 1

      If you wish that LISP features were added to C++, then why don't you just use one of the CLISP or Scheme dialect compilers that generate code as fast as native C ? Or a ML dialect like Haskell or Objective CAML. Scheme dialect Bigloo has objects, pattern matching, threads, regexp, optional explicit typing and type inference, a GUI library, etc in addition to the original blessings of Scheme : closures, full introspection, meta-programming, absence of syntax, garbage collector.

    7. Re:Cool by stonecypher · · Score: 2, Informative

      lambdas and metafunctions: boost and spirit. However, I agree with you that they should become core langauge fetaures. Notably, that's what Boost is - a group that's working on implementing, in a rigorous and standard-friendly fashion, potential extensions. it's droolworthy; I'd say even moreso than Loki, though visible policies make other people's code far less painful. (Yay, Phoenix!)

      As far as type inference, I disagree.

      cParentClass * foo = new cChildClass();

      what's the redundancy of cFoo = new Foo(); ? You specify the type of the thing and then identify the creator and pass it information. Because you always have matched types and creators simply says that your code doesn't require some of the more complex leveraging of the language.

      Auto seems convenient at first, but consider the potential for problems. And really, what does it gain you? Five or six keystrokes, in the greater scheme of things, really just isn't that important. Predictability and specificity are, in my opinion, far more important.

      If you're so hard up for horizontal space that you can't make a single definition, stop tabbing 8 spaces, put a using or two in place, or get a bigger monitor. Jeez.

      --
      StoneCypher is Full of BS
    8. Re:Cool by Anonymous Coward · · Score: 0

      Sorry, this is a really horrible idea. What kind of object does 'auto' resolve to when you are working with a type more complex than 'int'? What kind of pointer does it resolve to when you have an inheritance chain 10 classes deep? What about multiple inheritance? Do you cast your 'auto' object before you invoke methods on it to make sure you're invoking the right base class method implementation?

      Hooray, you've saved thousands upon thousands of keystrokes for all the students writing their first 'hello int' applications, but it does nothing for real-world libraries. If you really want 'auto' objects then you're probably writing glue code and should be working with a strong scripting language, not C++.

    9. Re:Cool by be-fan · · Score: 1

      :) I'm using Boost in my OS kernel right now. Works great. Real testament to the portability of C++. However, the Lambda library leaves much to be desired. Even a small use of lambdas makes compile time shoot through the roof, and its absolutely impossible to debug a compile error, because the compiler spits out every template instantiation in the expression, which basically gives you an AST, only less readable...

      Also, I wouldn't push for full type inferencing ala OCaml. Operator overloading makes that very difficult. I'd be happy with an overloaded 'auto' keyword (which was suggested awhile ago on comp.lang.c++), which can be emulated pretty well already with GCC's 'typeof()' extension. The following expression:

      #define auto_m(name, init) typeof(init) name = init
      auto_m(var, vec.begin());

      could become:

      auto var = vec.begin()

      --
      A deep unwavering belief is a sure sign you're missing something...
    10. Re:Cool by be-fan · · Score: 1

      A) They don't generate code as fast as native C. For most purposes, the 50-75% they do get (reliably) is good enough, but not for the kind of work I do.
      B) The memory requirements and runtime requirements make are the kicker. My work involves embedded programming, and my personal hobby is kernels and system-level stuff. I have no desire to get the cmucl runtime to operate freestanding, and there is no way I could squeeze Lisp binaries onto my already overloaded embedded systems.

      --
      A deep unwavering belief is a sure sign you're missing something...
    11. Re:Cool by be-fan · · Score: 1

      A lot of C++ code isn't OO though. I've written entire applications without a single hint of OO, just the oddball imperative/functional soup the STL engenders. Because of the heavy use of value types in STL programming, type inference saves you from having to put in a lot of redundant type declarations.

      As for horizontal space, I'm talking about the following:

      for(std::vector::iterator i = wordVec.begin(); i!=vec.end(); ++i)

      That's way too complicated for a simple loop. I consider the rampant use of typedefs to be something of a hack, only necessary because the type system has too many features without a good way to remove some of the burden of manual type management from the programmer.

      --
      A deep unwavering belief is a sure sign you're missing something...
    12. Re:Cool by be-fan · · Score: 1

      auto would simply resolve to whatever the type of expression on the right hand side was. So:

      auto x = foo

      would simply be a shortcut for:

      typeof(foo) x = foo;

      The compiler still has enough information to catch any type errors you could make at compile time. OCaml and Haskell (among others) work this way (with functions and whatnot having type declarations, while most stack variables don't) and in practice, it doesn't seem to be a problem.

      --
      A deep unwavering belief is a sure sign you're missing something...
    13. Re:Cool by xenocide2 · · Score: 1

      Of course they don't generate code as fast as C. Why? LISP, Haskell and OCaml are very high level languages with their full featured closure and program representation. As a consequence, the run time performance is hurt. C is fast in part because it doesn't use these features. It types things as best it can (well, we'll ignore the void loophole for now) and compiles under the assumption that the types are all correct.

      Now, there are features within C that allow you to do these sorts of things. You can (ab?)use the preprocessor to do inline expansions for stuff, like the wxWindows library does. You can also use void pointers to the function you'd like to pass. The type inferrence is interesting, but I wonder what the need for the auto keyword would be in that situation. It appears to be a flag that the following assignment is intended to create a new variable, but I can't imagine a scenario offhand in which you wouldn't be able to recognize this without the auto keyword.

      What's interesting is that despite all those handicaps, ML based languages can achieve and sometimes defeat C based program's speed. Very difficult. But one of the key areas that these functional languages lose out on is array manipulation. For whatever reasons, C just kicks the pants off of the competition. Of course, array manipulation and memory operations are among the most important tools in embedded programming, alongside synchronization.

      --
      I Browse at +4 Flamebait

      Open Source Sysadmin

    14. Re:Cool by zCyl · · Score: 1

      auto x = foo
      would simply be a shortcut for:
      typeof(foo) x = foo;


      #define AUTO(x,foo) typeof(foo)(x)=(foo)

      now you can write:

      auto x = foo;

      as:

      AUTO(x, foo);

      If you are really inclined to want this.

    15. Re:Cool by Anonymous Coward · · Score: 0

      I think we both know the only kind of work you do is sit on Slashdot and troll all day.

    16. Re:Cool by Anonymous Coward · · Score: 0
      foo* i = new foo;

      is redundant... and usually a bad c++. why not simply

      foo i;

      ?
      new is needed in C++ only when you use inheritance and raw pointers are a bad idea even then (auto_ptr or reference counted smart pointers avoid a lot of headaches). so for inheritance:

      auto_ptr<foo> i(new foo_special);

      which does not have redundance anymore...

    17. Re:Cool by statusbar · · Score: 1

      And beyond that, your code must know that wordVec is a std::vector... C++ does not allow you to do 'typename wordVec.iterator i;' so without 'auto i=wordVec.begin();' the code breaks if you later decide to use a different container for wordVec.

      --jeff++

      --
      ipv6 is my vpn
  103. In Other News.... by Lord_Slepnir · · Score: 1
    Microsoft has announced plans to introduce C##0x.net.

    "We don't know what it will be, but i'm sure we'll find ways to make it more....umm...programish

  104. Re:It's great to see some metaprogramming related. by Laplace · · Score: 1

    Yeah, metaprogramming makes C++ an ugly Lisp. Keep in mind that Lisp code is generally regarded to be very ugly.

    I'll put my flame suit on now. I just insulted both C++ and Lisp.

    --
    The middle mind speaks!
  105. Re:Whatever. by Anonymous Coward · · Score: 0

    Hmm... cluster number crunching in JavaScript... are you the author of the prime number shitting bear!?!?

  106. C++0x? by zephc · · Score: 2, Funny

    how about a much cuter name, like "Snugglums" or "Bwumpie-poo"?

    --
    "I would say that 99 per cent of what my father has written about his own life is false." - L. Ron Hubbard Jr.
  107. Re:Whatever. by mr_e_cat · · Score: 0

    I do not have time to re-invent a linked list for the umpteenth time

    This may be naive, but couldn't you just cut and paste your previously used linked list. It seems to me that the one thing that C++ in particular and OO in general has sacrifices is simplicity. In OO to create a linked list you define a class which inherits from another class (which inherits from another class??), then you create the object. That is a lot of code. It becomes quite hard to understand what is going on when you do have a problem.If you just pasted in your previous linked list code, you will have a simpler program. As I said, the one thing that is ignored is simplicity.

  108. C++ == Algol++++++++++ by Anonymous Coward · · Score: 0

    > B actually existed... it was the language that predated C.
    >
    > I've no idea if there was an A though.

    There was no A, but B was actually derived from BCPL. BCPL was interesting in that it included two features not found in C:
    * Single line comments that begin with //
    * The ability to create expressions with statements in them (sort of like inlining or closure expressions)
    * All variables had "word"-size (a la FORTH) so you didn't need to declare types.

    C++ adopted "// comments" so maybe C++ v2.0 will adopt closure BCPL closure expressions;-)

    You can find out more about BCPL here:
    http://www.lysator.liu.se/c/clive-on-bcpl.html

    Anyway BCPL (Basic CPL) was a simplification of CPL which was called "Combined Programming Language".

    http://www.wikipedia.org/wiki/Talk:CPL
    http://w ww.wikipedia.org/wiki/CPL

    CPL was derived from Algol.

    So in essense, C++ could be renamed:
    Algol++++++++++

    1. Re:C++ == Algol++++++++++ by PetWolverine · · Score: 4, Funny

      Maybe B was still short for BCPL, and C is now short for CPL because it's not Basic any more. So next, P would would be short for PL because it's not really combined (?) any more. And finally, L would be for, well, L, because it's not really for programming any more.

      --
      I found the meaning of life the other day, but I had write-only access.
    2. Re:C++ == Algol++++++++++ by Anonymous Coward · · Score: 0

      AmigaDOS 1.0 was written in BCPL...we'll actually it is a port of another operating system written in BCPL. AmigaDOS ran ontop of Exec, which was the real-time multi-tasking kernel designed to run the 680x0 and the coprocessors (COPPER, Denise, Agnus/FatAgnus). Besides sucking, AmigaDOS and the terrible-looking TV-quality fonts (even at high-res) were really the biggest turn-offs of the platform to the Word/Excel/Basic people. If only they had found a way to license a 68K port of DOS, or some other action to pay-off the convicted monopolist...the world would be so different today...but they were too busy fighting with their former CEO and holoucast survivor who was busy selling knock-offs under the bankrupt ATARI logo. (That self-hating bastard knew he didn't have the "chips" that took Amiga four long years to develop --but like MS vs. Apple, he also knew that it didn't matter to Joe Q. Public as long as his POS knock-off looked enough like an Amiga. He failed to see the forest above the trees...and all he did was convince businesses that Amiga and Atari were one in the same. If only he had been "American" enough to realize that for all time, Atari=video games..so he screwed the credibility of BOTH platforms with his advertising and, in the end, even a Word/Excel/Basic port wouldn't have helped. Gates justifiably claims his decision not to port to the Amiga (despite the urging of everyone) as a very sound business decision --which it was only in the face of what the self-hating holocaust bastard did with Atari. At least his puppet-Indian VP of Engineering who was in charge of making the knock-offs was not stupid enough to use a BCPL-based DOS, as the poor Los Gatos hardware engineers were dooped into doing.

  109. Re:Masturbating Jackstone by Anonymous Coward · · Score: 0

    You are simply fabulous. Love the shoes!

  110. Actually... by Houdini91 · · Score: 1

    most compilers worth their salt will eleminate the temporary local variables for code like this at compile time. It's a technique called return value optimization.

    - Houdini

    1. Re:Actually... by Anonymous Coward · · Score: 0
      most compilers worth their salt will eleminate the temporary local variables for code like this at compile time. It's a technique called return value optimization.
      What the hell is wrong with the people who mod posts? Why was this given a 1? Some person in the message previous to the one I'm referring to makes an "Insightful" (so say the mods) observation about one of C++'s supposed flaws, and then this guy posts a correction.. and so he gets a 1.
    2. Re:Actually... by Anonymous Coward · · Score: 0

      Because Houdini91 posts at score 1 by default.

      No mod points were applied to that post at all. Duh. Retard much?

  111. Why not just tweak C#? by spizm · · Score: 1

    C# is already a very cleaned up version of C++. If you turn off garbage collection, add C++-style new and delete keywords, some modern templating syntax, and a compiler, you get the next version of C++.

    1. Re:Why not just tweak C#? by be-fan · · Score: 1

      Because its easier to polish a language than to fundementally change language paradigms. The template syntax alone would take as long to put into C# as it did to put into C++. Changing C# from a garbage collected to a manual memory model would be fundementally changing the memory management paradigm.

      --
      A deep unwavering belief is a sure sign you're missing something...
    2. Re:Why not just tweak C#? by ratfynk · · Score: 1

      "Because its easier to polish a language than to fundementally change"

      C# is Polish. Which is only somewhat easier than Suomi to understand outside its MS GUI.

      --
      OH THE SHAME I fell off the wagon and use sigs again!
  112. What about existing proposals? by Chris+Hall · · Score: 3, Funny

    Rather than just rushing into designing yet more features for the language, shouldn't existing proposals such as This 5-year-old proposal for overloading be taken into consideration? :-)

    1. Re:What about existing proposals? by booch · · Score: 1

      Wow, excellent proposal. They had me going there. The first half of the proposal actually seemed reasonable, if not particularly C-like. It was only when they said that variables should be limited to a single character that I started to worry.

      --
      Software sucks. Open Source sucks less.
    2. Re:What about existing proposals? by Screaming+Lunatic · · Score: 1

      It seems that the moderators (and maybe even the poster) have taken this post seriously. If they had read the actual linked document, they would have found that the last sentence reads, "...this project is usually referred to as "Project Arpil Fools""

  113. Re:It's great to see some metaprogramming related. by joib · · Score: 1

    Actually, from FORTRAN 90 onward, pointers (somewhat restricted compared to C, but still) as well as dynamic memory allocation are part of the language. Making FORTRAN as slow as C.. :-)

    Anyway, I don't think the difference between C and fortran is so big anymore. Compiler tech has improved, and in fact most fortran compilers have identical backends with the C/C++ compiler from the same manufacturer.

  114. Re:It's great to see some metaprogramming related. by exp(pi*sqrt(163)) · · Score: 1

    No insult! Template metaprogramming is ugly as hell. But it does get the job done well sometimes. An alternative language might be something like Haskell which I think looks pretty beautiful. But outside of contrived benchmarks its performance seems to suck.

    --
    Doesn't it make you feel good to know that our freedoms are protected by politicans, lawyers and journalists.
  115. More info on CPL -- ML and C++ are cousins! by Anonymous Coward · · Score: 0

    Here's some more info on CPL:
    http://www.instantweb.com/foldoc/foldoc.cgi? CPL
    http://www3.oup.co.uk/computer_journal/hdb/Vo lume_ 06/Issue_02/default.html
    (Look for the "The main features of CPL" text.)

    Apparently ML is also derived from CPL too so ML and C++ are distant cousins.

  116. Re:SCO owns nothing but C++rap by catscan2000 · · Score: 2, Funny

    In related news...

    SCO announced earlier this morning that they obtained all rights to the English language from England for an undisclosed amount and plan develop a "reasonable and non-discrimatory" license plan for individuals wishing to communicate using the language. A SCO spokesperson recently told reporters: "We're not after the individual English speakers, so there's no need to worry. It has come to our attention that IBM intentionally placed some English words into the open-source Jive language and is in clear breach of our license with them, forcing us to take them to court for... (cue music and camera zoom-in) One Meelion Dollars."

    Although details are not yet finalized, SCO promises that the royalty for using the English language will be affordable, "something in the ballpark of 3 to 4 cents per word communicated." In that scenario, this news story would cost us several dollars, which is quite cheap and reasonable in this news agency's opinion. More at 11.

  117. Easy to Search Names by mikeboone · · Score: 1

    I wish they'd give programming languages and other software unique and easy-to-search names. C++ doesn't search well in some search engines. C is even worse, since it's so generic and short. Add to that software with names like Word and Access.

    It makes a difference when it comes time to search on a feature or problem.

  118. What I want to see in C++ by soft_guy · · Score: 1

    Unfortunately the "check it out" link is slash dotted... What I'd like added to the C++ language would be the ability to dynamically iterate through the inheritance structure of an object using type_info structures at runtime. For example, you have an inheritance structure where: A inherits from B inherits from C inherits from D. I get an A* as an argument. Right now, I can call typeid and find out is actually a D*. If I know about class B, I can dynamic_cast it as B. However, my code doesn't know about class C (let's say I'm a DLL or something), I can't really find about class C. It should also handle cases of multiple inheritance. There was a real-world case where I needed this. Sure, if the system had been properly designed in the first place I wouldn't have needed it, but I had to fix something and it would have been easier if I could have dynamically asked for a list of the type_info structures that the class with some type_info structure inherited from. The case was that I was dispatching some objects to handlers that had registered for objects by their type_info structure. In my stupidly named ficticious example above, if you register for class C and nobody else registered for D, you would get any D's that are dispatched. My code treated all these classes as anonymous and only knew about A. I kept a std::map around for doing the dispatches. I solved it non-elegantly by requiring that any class derived from A call a base class method called SaveTypeInfo in all versions of their constructors. SaveTypeInfo did somehting like: mTypeStack.push(&typeid(self)); where mTypeStack is a std::stack in the base class A. What that results in is a stack of type_info*s poiting to: D C B A (bottom of stack) Then I would compare the top of the stack to the map, if it exists in the map, dispatch it, if it doesn't then pop it off and try again until the stack is empty.

    --
    Avoid Missing Ball for High Score
  119. Re:It's great to see some metaprogramming related. by exp(pi*sqrt(163)) · · Score: 1

    I haven't played with FORTRAN recently myself but there are figures and discussion published by Todd Veldhuizen that are certainly a lot more recent than '90.

    --
    Doesn't it make you feel good to know that our freedoms are protected by politicans, lawyers and journalists.
  120. Hmm...0x or 1x? by clary · · Score: 2, Interesting

    Can I be considered an old-timer for remembering when Fortran 90 was still the Fortran 8X proposal?

    --

    "Rub her feet." -- L.L.

    1. Re:Hmm...0x or 1x? by Anonymous Coward · · Score: 0

      I use Fortran 77, you insensitive clod!

  121. Why? by GnuVince · · Score: 3, Insightful
    I keep hoping that C++'s use will shrink and that the language will be replaced by a more dynamic language for user applications (Smalltalk, Lisp, Python, etc.) It seems that a new standard might renew some people's desire to write static applications, which might now be a good thing.

    I recently started messing with Squeak and I think that it is the kind of thing programming language should try to mimic: an easy to use, very dynamic environment. Let's take computing to a new level, leave the 90s behind please.

    1. Re:Why? by GnuVince · · Score: 1

      Whoops, s/now/not. Sorry about that!

    2. Re:Why? by Anonymous Coward · · Score: 0
      I recently started messing with Squeak and I think that it is the kind of thing programming language should try to mimic: an easy to use, very dynamic environment. Let's take computing to a new level, leave the 90s behind please.


      Sp, you propose leaving the 90s behind by using an implementation of SmallTalk 80? Why not just say "use lisp (1950s)" and get it all over with?

    3. Re:Why? by jbrandon · · Score: 1

      Another brilliant post from someone too lazy to explain themselves.

      Until your claims have warrants and data, you're a big fat troll.

  122. My favorite feature is still missing by alexo · · Score: 1

    Closures.

    1. Re:My favorite feature is still missing by multi+io · · Score: 1

      Closures.


      Use GCC.
      #include <stdio.h>

      int fxtimes3(int (*f)(int), int x) {
      return 3 * (*f)(x);
      }

      int main() {
      int var=42;
      int plusvar(int param) {
      return param+var;
      }

      printf("%i\n",fxtimes3(plusvar,7));
      }
      Gives
      $ gcc gccclosures.c -o gccclosures
      $ ./gccclosures
      147
      $
    2. Re:My favorite feature is still missing by Tiny+Elvis · · Score: 1
      looks like a closure but isn't. A real closure would be more like:
      #include <stdio.h>

      void *get_closure(int pvar)
      {
      int closure(int param) {
      return param + pvar;
      }
      return (void*)closure;
      }

      int fxtimes3(int (*f)(int), int x) {
      return 3 * (*f)(x);
      }

      int main() {
      int var=42;
      int (*closure)();

      closure = (int (*)()) get_closure(var);
      printf("%i\n",fxtimes3(closure,7));
      }
      The problem is that the param 'pvar' in get_closure() isn't properly captured. In Common Lisp this would be:
      (defun get-closure (pvar)
      #'(lambda (param)
      (format t "pvar = ~a~%" pvar)
      (+ pvar param)))
      (defun fxtimes3 (func val)
      (* 3 (funcall func val)))
      (defun main ()
      (let* ((var 42)
      (closure (get-closure var)))
      (format t "result = ~a~%" (fxtimes3 closure 7))))
      Any lexically visible variables that the closure func refers to will be valid for as long as the closure is valid -- in your example when pvar goes out of scope the closure then refers to some random stack value.
    3. Re:My favorite feature is still missing by multi+io · · Score: 1
      Any lexically visible variables that the closure func refers to will be valid for as long as the closure is valid -- in your example when pvar goes out of scope the closure then refers to some random stack value.

      Right. Thanks for the clarification.

    4. Re:My favorite feature is still missing by Anonymous Coward · · Score: 0

      I don't understand what this is doing.

      Can you direct me to a web-site that explains exactly what closeures are and then explains how to do them in C++ with step-by-step instructions of what's going on so I am able to follow.

    5. Re:My favorite feature is still missing by alexo · · Score: 1

      > Use GCC

      The point is to have the feature in standard C++, not to use a proprietary extension to the language.

      You might as well have suggested to use CLOS or OCAML.

    6. Re:My favorite feature is still missing by multi+io · · Score: 1
      I don't understand what this is doing.

      Well, just look at the examples :-). A closure is something like a local (lexical) variable that happens to be a function, and can freely access in its body all variables (including other local variables) visible at the point where it is defined. The closure can be used just like any other local variable, i.e. it can be passed to other functions as a parameter, and it can be returned from the function where it was defined as a return value (that's what's not working in GCC). The respective receiver of the closure may then call it freely.

      Can you direct me to a web-site that explains exactly what closeures are and then explains how to do them in C++ with step-by-step instructions of what's going on so I am able to follow.

      C++ doesn't have closures. GCC has a half-complete substitute, as explained in the parent posting. Google points here. The GCC implementation ist explained here.

  123. Re:What C++ really needs to do by DukeyToo · · Score: 1

    Going with the analogy of glue vs bricks and mortar, I'd like to point out some obvious problems with C++, from the point of view of someone who works more on the "glue" side.

    When I write a program in VB, there are precisely two ways that I can mess things up from the point of view of causing an application crash. One is to create circular references between objects, and the other is to cause a stack overflow. I know enough to avoid those two problems, but my programs still crash sometimes, because of the brick & mortar that my program relies on.

    I don't blame MS for that, I blame the languages they use, i.e. C and C++. What C++ needs is better protection from programmers against themselves. Buffer overflows, pointers pointing where they should not; all that stuff needs to be harder to do. Give us guys with the sticky-glue fingers something decent to work with!

    MS have it right with C#, i.e. no more pointers, no possibility of circular references. Unfortunately, the cost of that seems to be the runtime framework to do GC, which would be unacceptable for low-level stuff in C++.

    Oh well. I forgot my point. Anyone?

    --
    Most writers regard truth as their most valuable possession, and therefore are most economical in its use - Mark Twain
  124. remove export by Phronesis · · Score: 1

    The most interesting discussion on the comments list was the material on removing export. I had always thought export was a good idea and the comments from EDG completely changed my mind.

    1. Re:remove export by devphil · · Score: 2, Interesting


      EDG are some really smart people, but their comments have since then been disproven.

      export in itself (specifically, the idea which export is trying to implement) is a good idea. Where the committee screwed up was mandating its existence without any prior experience.

      Keep in mind that the point of an ISO standard is not to require/"legislate" new ideas, but to standardize existing practice. Everything in C++98 had already existed by the time the standard was even close to being done, except export.

      --
      You cannot apply a technological solution to a sociological problem. (Edwards' Law)
    2. Re:remove export by Phronesis · · Score: 1

      Could explain how the EDG comments have been disproven? Can you provide some pointers to where I could read more about the disproofs?

    3. Re:remove export by Ben+Hutchings · · Score: 2, Informative

      I think that by "EDG comments" you are referring to the paper "Why We Can't Afford Export". This was not actually written by EDG. There was a thread on comp.std.c++ recently which discussed this. You'll need to look at the whole of the first article as it refers to export only in a footnote.

    4. Re:remove export by Ben+Hutchings · · Score: 1

      Here and here are the two articles in the thread that really answer the paper's claims.

    5. Re:remove export by HuguesT · · Score: 1

      That's strange I find this thread particularly uninformative.

      If you read the EDG paper, they are saying in effect that you can't compile templates to .obj files to be put in a standard .LIB or .a library somewhere, because the users of that template library will need to see the template definition to be able to instantiate it on their own objects and types.

      This opens a can of worms. What do you then compile the template to? Probably some kind of obfuscated source form that your compiler can still read and use to instantiate. Now this obfuscated form is not standard. Presumably EDG compiled this to machine-readable standard C++ that any compiler can read, but what if Microsoft decides to output the template source to some kind of proprietary weird archive format that only they support? What a great way of ensuring that library users will be tied to all current and future versions of your compiler!

      I think this is what EDG meant by the standard not being specific enough about `export'.

      From the above it is relatively clear that export has few benefits. People who ship template library can already obfuscate their template source code and simply document their interface in a manual somewhere, if they really want to do that.

  125. Free range checker for c++ by seanmceligot · · Score: 1

    assert(index < size);

  126. You mean like default namespaces? by moogla · · Score: 1

    I don't see what the issue is there really. I imagine it implemented as follows:

    virtual union {
    int i;
    float j;
    } k;

    Where i === k.i, j === k.j in the current namespace and scope.

    If i is ambigous because an int i already exists outside the union in a similar scope, the behavior is to favor the "inner" scope provided by the union.

    Similarly, we can have:

    struct outer_t {
    int member;
    virtual struct inner_t {
    int member;
    int data;
    } inner;
    } outer;

    Where outer.member === outer.inner.member (there is no seperate memory allocated for names that collide). However, inner_t structs can be seperately allocated, and for example:

    inner_t x = outer.inner;

    is a valid statement doing exactly what you expect.

    --
    Black holes are where the Matrix raised SIGFPE
    1. Re:You mean like default namespaces? by Ben+Hutchings · · Score: 1

      Anonymous unions already exist in C++, and I think they do in C as well. I don't understand the point of anonymous structs, though - why not put the members directly in the enclosing struct?

  127. how about... by AntiOrganic · · Score: 1

    How about we rename it C=*((long *)0)?

    Or does C++ have too many pointer problems already?

    1. Re:how about... by ZamesC · · Score: 1

      Actually, between vector and std::string, there virtually no reason to ever use a pointer again. (And for the rare occasion that you do, there's boost::shared_ptr)

  128. Please, God, no more ACE by truth_revealed · · Score: 1

    C++ needs ACE like dogs need submarines.
    Can ACE possibly be any more complicated than it is?
    The ACE developers should really look at Qt/KDE to see how to design intuitive C++ APIs.
    Boost has the right idea, but I fear they are heading down the ACE path of needless complexity.

  129. The name is wrong... by Anonymous Coward · · Score: 0

    Wouldn't "C+=2" be a more appropriate name?

  130. Re:It's great to see some metaprogramming related. by Anonymous Coward · · Score: 0

    What about OCaml ? (See the last item in "news" for a "benchmark")

  131. I totally agree by Gendhil · · Score: 1

    But some people tend to faint when you tell them you coded a DB front end application in VB, and tell you how C++ is superior. All I'm saying is that if C++ wants to be the end-all-be-all of programmation, it seriously lacks in that department. If you stick to real time programming, C++ seems very good indeed.

    1. Re:I totally agree by 8282now · · Score: 1

      What are you crazy?!!! You admit to programming (if you can call it that!!) in VD.. I mean VB?!!

      But among the many other points about VB (requiring MS technology, huge bloated libraries, instability, & etc,...) ...why'd you program that DB front end in VB again...?

      Relax, I'm kidding. I suppose if someone paid you to program in VB, what can you do? Unless you're independently wealthy or can at least afford to pick and choose your work.
      Yes, I know this doesn't really speak to your opinion that VB is superior as a presentation/front-end development platform.
      For similar reasons, I don't like to use C++ for manipulating large amounts of text processing. The right tool for the right job.

      One last little jab....
      ... So does that DB front end run on Linux? :)

  132. A Clarification by Gendhil · · Score: 1

    I work in Europe. Delphi is far more widely used here, because it's taught in several universities. "because they were DESIGNED to be glue and C++ was designed to be the bricks and mortar." Can I translate that as : businesses don't need/want to reinvent the wheel every time they have a problem to solve ? :) I know once you have a good code base in the house it's not so bad, but most small or middle sized businesses most likely won't ever have the time to get that.

  133. Re:It's great to see some metaprogramming related. by exp(pi*sqrt(163)) · · Score: 1

    Tried that too as I was initially impressed with those benchmarks. I found the performance really started dropping when I started using more complex datastructures. Still, I might consider OCaml in some situations.

    --
    Doesn't it make you feel good to know that our freedoms are protected by politicans, lawyers and journalists.
  134. Too late to fix a bug in legacy code? by David+Gould · · Score: 1


    Since the postfix increment operator yields an rvalue (unlike the prefix increment operator, which yields an lvalue), ++c++ is not a valid expression in C++.

    "...in C", I would have said, since in order for the original joke to work, it has to be interpreted in plain C syntax.

    But anyway, you bring up a good point: C++ should really have been called "++C" all along, since the expression "C++" increments C (as intended) but returns the old value, not the new incremented value, but you'd want the expression to evaluate to the new language.

    Also, my language-laywering is a bit rusty, but if the pre-increment operator yields an lvalue as you claim, doesn't that mean that "++++C" should be valid? If so, why does it give me an error "invalid lvalue in increment"? Note: "invalid lvalue", not "not an lvalue" -- are there different kinds of lvalues, or something?

    --
    David Gould
    main(i){putchar(340056100>>(i-1)*5&31|!!(i<6)<< 6)&&main(++i);}
    1. Re:Too late to fix a bug in legacy code? by hummassa · · Score: 1

      in gcc 3.3, it works, as the standard says it should. (I mean, ++++i);

      --
      It's better to be the foot on the boot than the face on the pavement. ~~ tkx Kadin2048
    2. Re:Too late to fix a bug in legacy code? by Kakurenbo+Shogun · · Score: 1
      C++ should really have been called "++C" all along, since the expression "C++" increments C (as intended) but returns the old value, not the new incremented value, but you'd want the expression to evaluate to the new language.

      Not so. At least originally, there were no compilers that actually compiled C++. What they did was convert C++ code to C, which was then compiled by a C compiler. So the joke was that you increment it, but it returns the old value.

      That also brings up a problem with the name "C+=2"--it's a pre-increment (right?). The appropriate name would be "C++2", where "++" is a user-defined binary post-increment operator (which would require the second operand to be a const in order to distinguish it from 2++C, the user-defined binary pre-increment operator, the first operand of which must be a const.)

      --
      Convert RSS to HTML - integrate webfeeds into your website
    3. Re:Too late to fix a bug in legacy code? by David+Gould · · Score: 1


      So the joke was that you increment it, but it returns the old value.

      Wow, you're right -- it's even funnier that way. Thanks.

      --
      David Gould
      main(i){putchar(340056100>>(i-1)*5&31|!!(i<6)<< 6)&&main(++i);}
    4. Re:Too late to fix a bug in legacy code? by osu-neko · · Score: 1

      Actually, the old joke was (this was during the ARM days, before there was a real standard, and I'm afraid I forgot who said it), every time you think you've learned C++, you find Bjarne has added new features that aren't in you're compiler. It's been incremented, but you're still using the old value...

      --
      "Convictions are more dangerous enemies of truth than lies."
  135. Put it in C, not just C++ by crow · · Score: 1

    One thing that has always bugged me about C++ is that when they added object-oriented features, they also threw in a bunch of other useful stuff that has nothing to do with OO.

    Wouldn't it make sense to put out both a new C and C++ standard at the same time, where C contains everything from C++ that isn't object-related?

    1. Re:Put it in C, not just C++ by ZamesC · · Score: 1
      The C committee and the C++ committee hold "semi-joint" meetings (they are held consecutive weeks at the same location). There is also a large overlap in membership.

      They are trying to bring the non-OO stuff to C, but it's a bit difficult. Is the string data type "object orient"? It's implemented as a templated class, but that's irrelevant, right?

      What about the complex data type? where the template implementation is more explicit than with string.

      What about the algorithm in the STL? They work on C arrays. Should they be moved to C?

  136. (c++)++ by Anonymous Coward · · Score: 0

    Actually, that's not legal C++. You can't modify c twice without an intervening sequence point. (No, that isn't a pun.)

  137. -1 Didn't get the joke. by Anonymous Coward · · Score: 0

    Geez... wake up!

  138. What is C++ used for? by Anonymous Coward · · Score: 1, Insightful
    In Stroustrup's write-up on C++0x (page 5), he says that changes to C++ are required to "Make C++ a better language for systems programming and library building." This brings up a long standing question (or set of questions): what kinds of software do people really code in C++ and are there some tasks for which it well suited or poorly suited? Please note: these are serious questions, and NOT FLAME BAIT!

    Clearly, C++ has many features for libraries, and these support what I think of as infrastructure/middleware kinds of applications. Just link your code to a C++ library and access all sorts of other features. It may or may not do a good job of this, but it is clearly part of the charter of the language.

    The real issue is if C++ is a systems programming language: is it actually used for classical system programming tasks? I think not. Let me give examples:

    1. Language implementation. Are any languages actually implemented in C++? For all the open source software I have seen, C is the language used for almost all language implementations. Unless there has been some big change GCC is written in C, I think. Is VC++ or the Intel C++ compiler written in C++? Is this a historical issue, or is there some reason that language implementers stick to C? For a counter example, there are many LISP systems written in LISP using meta-circular implementations.

    2. Operating systems. I know of no operating systems written in C++, and I doubt that it is possible. C++ assumes a lot of support exists for memory management and tasks like interrupt handling. When you are in this domain, you have to be very strict about memory allocation and deallocation, and C++ often implicitly creates objects on the fly. You would have to code in a very non C++ style to keep from constantly going into and out of storage allocation.

    3. Real time and embedded programming. All the problems of operating systems along with code bloat and possible speed problems due to method overhead.

    Does anyone have counter examples? Are there other typical systems areas where C++ is not the right choice? I'm not trying to start a flame war, I really want to get intelligent meaningful feedback.

    1. Re:What is C++ used for? by jdennett · · Score: 1

      Read Bjarne Stroustrup's website to find out why most of your fears are unfounded, and to see a list of examples of real uses of C++.

      A fundemental principle of C++ has been the "zero overhead" rule; there's no reason for good C++ code compiled with a good C++ compiler to be slower than C (and modern techniques allow C++ to be faster for some things, such as numerics).

      Bjarne's homepage is still at http://www.research.att.com/~bs/.
      You'll find a list of examples of C++, as well as some debunking of performance myths about C++.

      The C++ committee are also producing a "technical report" on performance, which gives more detailed refutations of many myths about C++ performance problems.

      I have used C++ for embedded work. There is not a problem with C++ "implicitly creating objects on the fly". C++ allows tight control of memory allocation. C++ does not assume anything about interrupt handling.

      Many compilers are written in C++ or generate C++ as their output. There is a move to use C++ in gcj, GNU's Java compiler.

      There are problems with C++, but I don't think you've hit on them.

    2. Re:What is C++ used for? by be-fan · · Score: 1

      2) I'm writing a kernel in C++ right now. The whole runtime is only 200 lines of C. I can get away with that because on the compilers I'm using, the C++ runtime libraries are almost, but not quite, freestanding.
      3) Heh. Using C++ for embedded programming too. Of course, its seriously powerful embedded hardware, but C++ is a great language for embedded use. The only place "bloat" enters into the picture is (possibly) with templates. Speed is never a factor --- C++ code is almost always faster than C code. For example, G++ has such a good optimizer, that a class containing a single integer, with overloaded operator +, -, etc, performs just as fast as a plain integer. For data structures, C++ is usually faster (at the cost of a little code bloat) because templates allow comparison functions and what not to be inlined, while C requires indirection through a function ponter.

      --
      A deep unwavering belief is a sure sign you're missing something...
  139. no need to upgrade C++ language by Anonymous Coward · · Score: 0

    Stardard C is
    still a decent language. What gives the language its power is the Stanard
    C Library. Rather than focus on improving the language itself, which I
    think does not need to be done, why not focus on improving the standard
    library interfaces for cross platform portability. I write everything in
    standard C, sometimes going into C++, and I use C++ compilers to compile
    my code. I find myself having to write or rewrite common code just to get
    common functions to work. I'm not on any committees steering the
    direction of these languages, but I know that if you would recommend
    serious improvements to the fundamental API itself, the language would in
    turn be a better language directly because of it. For example, there
    exists no regular expression (i.e. PCRE) API functions in the standard C
    library. There should be. It should have been in there 10 years ago. It
    sucks that millions of people have to reinvent the wheel every day because
    the standard library is inefficient for common programming tasks..

  140. The D Programming Language by Anonymous Coward · · Score: 0

    The D Programming Language is the successor to C++.

  141. if someone then ATT by axxackall · · Score: 1

    Last time I worked in ATT I've met Mr. Stroustrup there. If ATT owes Stroustrup (does he work there or not?) and he owes C++ (is he the inventor of C++ or not?) *and* the ownership relation is transitive (this part could be more difficult to agree) then ATT owes C++. Sort of.

    --

    Less is more !
    1. Re:if someone then ATT by Anonymous Coward · · Score: 0

      you mean to say "owns" not "owes", right?

    2. Re:if someone then ATT by njchick · · Score: 1

      I work in AT&T (In fact, in the same building as Bjarne Stroustrup), and I can assure you that AT&T doesn't own him or me.

    3. Re:if someone then ATT by Anonymous Coward · · Score: 0

      ooowwwnnnnnsss, ooowwwnnnnnsss.

      (Slapshot refernce for those who don't get the joke)

  142. Digital Mars - D by Vej · · Score: 1

    If you're looking for a straight update of C++ ability and syntax, why not check out D developed by digital mars. It's based off of C++ compiler designs.

    http://www.digitalmars.com/d/

  143. Non-intrusive reference counting pointers by Kickasso · · Score: 1

    are horribly inefficient, and just plain wrong. I hope they don't make it into the standard.

    1. Re:Non-intrusive reference counting pointers by ozzee · · Score: 1

      They are making it the standard.

      You'd better speak up now or forever hold your peace.

  144. Lambdas by Anonymous Coward · · Score: 0

    Try the Boost Lambda library. It's hardly perfect, but it works well for most purposes.

  145. Java and C++ by master_p · · Score: 0, Offtopic

    Java is a joke for static applications for the following reasons:

    1) Lack of templates. This makes the code an unreadable mess of casting. Not to mention that every cast in Java is a dynamic cast.

    2) Lack of stack-allocated objects. Everything, even the smallest integer, must be allocated on the heap. Which means memory is too easily fragmented.

    3) The garbage collection moves memory around. That means that a Java pointer is a triple pointer: a variable which points to a variable which points to the object. Then, the garbage collector knows the middle pointer and can change its contents as needed by moving the object around. Twice as slow as C++.

    4) Garbage collection does not help the memory management problem. If I forget to nullify a pointer, the object remains in memory forever.

    5) A static app does not need a VM. It slows things down. Why should my code be translated on the fly, since a compiler would know beforehand what my program does ?

    Java has the following advantages:

    1) it runs everywhere.

    2) it provides a rich set of classes for every need. Especially gui.

    Now that I bashed Java and got it off my chest (I make applications with Java/C++ for a living), let's get off to C++. I love C++, especially for the template metaprogramming that it has, but it has some serious problems:

    1) the operator = is transferrable to a class/struct's members. Why not about the other operators ? For example the + operator. That way I could add two structs by using the operator + without having a temporary object to store the result.

    2) The lack of defining own operators

    3) Having to declare everything explicitely. For example x = 3 should be enough

    4) Having to declare two versions of each method, one when the object is const and one when the object is not const

    5) Having to put a semicolon after a class or struct declarations (as if the curly brackets were not enough)

    6) Having to declare forward stuff

    7) Having separation of header files and implementation files. This is the biggest language problem. It makes development problematic, since every change of the API requires two modifications.

    8) Lack of a standard String class

    9) I can't overload the operator '.'

    10) It does not have properties. A simple alias to get_x/set_x would be the x =, int i = x. It's only syntactic sugar, but it matters.

    11) lack of delegates, signals and slots

    12) lack of reflection

    13) unsafe variable argument list mechanism

    14) lack of threads

    There are many more things that are problematic, but I don't remember all right now (in one point in time I had constructed a list with 68 things that irritate me about C++). Although the language has the problems mentioned above, they can be overcomed by various techniques, and they are not as serious as the Java ones.

    The biggest problem is that it lacks standard libraries. A good language would come with standard gui, database, io, xml, collections, threads, internationalisation, etc. From all this, C++ has only collections. Mr Stroustrup correctly identifies the lack of threads, but what about the gui ?

    1. Re:Java and C++ by Michael_Jarvis · · Score: 1

      > 8) Lack of a standard String class

      What do you mean? There is a string class in the STL. It's often implemented differently "behind the scenes", but there is definitely a string class in the standard.

    2. Re:Java and C++ by msoori · · Score: 1

      You covered it pretty well. I programmed in C++ for 6 years before switching into Java and coming up on 6 years on Java too now. I hated Java when I switched into it, because all the cool things in C++ were removed from Java to help me protect me from myself. But as you mentioned, Java had its own advantages; mainly that of cross platform nature. My main reason for moving to Java was because I didnt want to learn that crappy class lib called MFC, and any alternative would have worked for me. One advantage you mised out about C++ is thtat of multiple inheritance. Done right, TRUE multiple inheritance is wonderful, but Java chose the easy way out by making it your burdont to implement multiple multiple interfaces. Other thing I hated about Java; lack of templates is being addressed in Java 1.5 with the addition of generics. Now all I'm waiting for is TREU Multiple Inheritance, Operator Overloading and MACROS. Then we'll have a C++ that is cross platform! By the way, doing something like this public class Foo { private boolean DEBUG = false; ... some code if(DEBUG) { System.out.println(blah); } } does not make a good replacement for Macros! One thing I always complained about java is its philosopy... "we think this is dangerous for you, so we wont let you do that" attitude. A knife helps you cut meat and vegitables. You can also use it to commit suicide. So, should you make the knives blunt? Let the user (programmer) decide that, not the implementors of the language. Long live freedom to do what you like!

    3. Re:Java and C++ by multi+io · · Score: 1
      Everything, even the smallest integer, must be allocated on the heap.

      Not true. Please get your facts right.

  146. Pattern Matching! by Anonymous Coward · · Score: 0

    Being a novice programmer and CIS student that has been writing small script-like task-automation programs, I think better pattern-matching support for C++ is a big step.

  147. Re:SCO owns nothing but C++rap by molarmass192 · · Score: 1

    Das ist nicht lustig! Und dann was sollten wir über englische Wörter in Linux tun?

    --

    Good people do not need laws to tell them to act responsibly, while bad people will find a way around the laws-Plato
  148. Why C++ committee will ikely ignore this issue by truth_revealed · · Score: 1

    The C++ standards committee does not want to get involved with operating system issues, nor do they want to impose a standard object file linking convention for various vendors' C++ compilers. I don't agree with this. C++ is forever doomed to be a statically compiled language with poor compilation speed if they do not mandate standard object file and shared library formats and conventions. The C++ ABI standardization is a good start - but it does not go far enough. And no, a template repository is not a solution - it's a band-aid covering this underlying problem of brittle classes and the need to recompile everything under the sun everytime a fundamental class' structure is changed. The .o (or .obj) files ought to store much higher level information about templates, classes, dependencies and typedefs. I know a number of projects that have switched to Java solely due to the poor C++ compilation speed issue. It is not unusual for a complete rebuild of a C++ system to take several hours. Don't believe me? Build Qt on typical two-year old hardware. This is not acceptable. Even the largest Java projects typically take under 10 minutes to build from scratch. Say what you will about Java, but they got it right when it came to creating a standard object file format (the .class file). A third party Java analysis tools industry was born overnight to take advantage of this common object format. As far as I'm concerned, the more standardization between various C++ compilers on different platforms - the better it will be for all C++ programmers.

  149. Re:It's great to see some metaprogramming related. by X · · Score: 1

    Modern C++ Design actually does a good job describing some of the more sophisticated metaprogramming work you can do with C++. It actually demonstrates that you can determine a lot of type information when metaprogramming thanks to C++ template semantics. Really cool stuff.

    Of course it does look ugly as hell. ;-)

    --
    sigs are a waste of space
  150. Mr Taco by nihilogos · · Score: 1

    Can we please have a preferences option to filter out anything that's been moderated as funny?

    I mean, it's nice every now and then but practically every single frickin post on this story is a "+X Funny". Anyone who actually has anything to say about the proposals is drowned in a sea of jokes about increment operators. And let's face it THERE'S ONLY SO MANY JOKES YOU CAN HEAR ABOUT INCREMENT OPERATORS.

    --
    :wq
    1. Re:Mr Taco by lww · · Score: 1

      Done.

      Now, when you (and only you) click on Preferences, then the Comments tab, then under Reason Modifier (assign a modifier to different moderation reasons), you can change Funny to have a modifer from -6..+6

      I hope this customization meets your needs, enjoy! ;)

    2. Re:Mr Taco by nihilogos · · Score: 1

      The first half of your sentence was great :)

      --
      :wq
  151. Re:It's great to see some metaprogramming related. by pmz · · Score: 2, Insightful

    No wonder so many people propose using C rather than C++.

    One reason C is so popular today is that it reached a critical threshold in abstraction: it isn't assembly code. C can be learned very quickly, and, given that prior programmers weren't too supidly clever, C-based programs can be easy to learn. I say "stupidly clever" because some people really do try to shoehorn functions into structures (oooo...I make C object-like) or use the preprocessor as if they have to, because it's there.

    C, used as intended (structures and functions that use structures), is actually quite refreshing to program in. You know, even Motif (a C library) isn't all that bad, as long as it is used directly without resorting to compulsive-big-clever-framework-because-I'm so-smart-syndrome.

    If you haven't caught on, I don't care for programmers who are so caught up in their genius that they invent these beasts of programs just to make them feel like they are architecting a space station or something. Usually, these are people just out of college, or "experienced" folk too stubborn to see their outside of their fantasy micro-universe. People need to realize that other people have to work with that code, too!

  152. Cyclone by Lucas+Membrane · · Score: 1

    The Cyclone project over at Cornell is the best thing I've seen in the C family of languages. It ought to be the next standard.

    1. Re:Cyclone by Nynaeve · · Score: 1

      Cilk is my favorite. It's not a general C language (although it is a superset), but I've used it and it's pretty nifty for distributed problems.

  153. C++: The name is accurate. by AntiOrganic · · Score: 1

    Postfix ++ returns the value before incrementing it, so it's almost like C++'s name itself is mocking it: Grown up, but too little, too late.

  154. Overloading on return types? by Haeleth · · Score: 1

    And what would "cout << f (b, c)" do then?

    1. Re:Overloading on return types? by exp(pi*sqrt(163)) · · Score: 1

      Oh, it wasn't meant to be a practical suggestion, just food for thought. However there are ways to resolve the ambiguity implicit in your code. You solve globally for the entire expression to find an assignment of types consistent with the set of overloadings are defined.

      --
      Doesn't it make you feel good to know that our freedoms are protected by politicans, lawyers and journalists.
  155. Who cares? by KalvinB · · Score: 4, Informative

    The extra bloat in Visual Basic is forced into my projects wether I use it or not.

    C++ on the other hand can have all the extra stuff it wants and it doesn't affect my project. If I don't wan to use templates or whatever, I don't have to. And the compiler won't force me to include anything.

    Whining about C++ having too many features is like bitching that Baskin Robbins has too many flavors. Nobody is forcing you to buy them.

    Ben

    1. Re:Who cares? by the_Speed_Bump · · Score: 1

      Nobody can write a compiler that implements all of C++98 properly, let alone 0x. That says something about the complexity of the language. I want to stop worrying about what features I use, for fear of stepping on the toes of a compiler that can't handle some corner of the language or other.

      --
      "Break out the gin, and the small violin, I'm a raging success as a failure." --Firewater
    2. Re:Who cares? by Lord+Ender · · Score: 1

      You sound like someone who has never had to work on a project with other people or maintain someone else's code.

      --
      A slashdotter who didn't build his own computer is like a Jedi who didn't build his own lightsaber.
    3. Re:Who cares? by obi · · Score: 1

      Well, the only problem is that when you work with other people (or opensource projects), you don't get to choose what features you're using.

      In other languages you can usually read other peoples' code without too much problems... can't say the same about C++

  156. This time with a link by X · · Score: 1

    Modern C++ Design actually does a good job describing some of the more sophisticated metaprogramming work you can do with C++. It actually demonstrates that you can determine a lot of type information when metaprogramming thanks to C++ template semantics. Really cool stuff.

    Of course it does look ugly as hell. ;-)

    --
    sigs are a waste of space
  157. Re:What C++ really needs to do by Fareq · · Score: 1

    See, the problem here is this.
    I'm a programmer, I want to write code, and I'm going to use a tool that lets me write code the way I want to write it, not a tool that tells me I'm too stupid to write good code, so it's going to force me to jump through hoops.

    Take, for instance, this particular annoyance in Java:

    I am trying to read from STDIN, wait, Java calls that System.in (everyone else in the universe seems to be able to agree on this one...) -- Specifically, I need something with a readLine() function, so I have to construct something around System.in.

    So, first, this annoys me greatly, because there is a certain amount of overhead in continually constructing new objects from old ones... In C I could just call a different function and pass it my FILE* pointer. I can (and generally will) do this in C++ as well...

    So... anyway, I do something like this (which comes from the Java API Docs)
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    two constructions... oh goody...
    So... anyway, now I readLine()
    Now... I have to do this (like about 99% of all my lines of code) within a try/catch block, because it _might_ throw an IOException.

    well... it might, except that the source is System.in so it won't. If it runs out of data, it'll sit and wait until I type something
    (unless, of course, System.in is set to some file, but then my particular program (a chatbot AI) is not really very meaningful.)

    But Java thinks I'm too stupid to know what I'm doing, so I can't call readLine(), I have to do this

    try
    {
    myNextLine = br.readLine();
    }
    catch (IOException ioe)
    { // Java doesn't trust me
    }

    this has turned one very simple line of code into 7, and don't tell me that I can save space by moving the brackets, I can save even more my not putting \n's anywhere, but sometimes it makes code more readable

    so... yeah... when I'm forced to use Java, I hate it... I keep thinking 'wow... this could be done 5 times faster with half the code in C++ and it'd be more legible to boot!'. I don't want to be protected from myself... If your not capable of enforcing reasonable restrictions on yourself, or your organization is too lazy to do real code-reviews, then your code deserves to suck it up...

    So... yeah... that's the second half of my "I hate Java" rant... perhaps someday I'll give y'all the first half.

    Until then,

    -- Fareq

  158. Car Repair by pyrrho · · Score: 1

    You know how I optimize my car repair projects? If I'm not using a tool that day, I throw the tool away so I don't get confuzed. Besides, who needs a hammer? I use the fat end of the screwdriver because the screwdriver has a much better interface. And I save a ton of time because I don't have to think "Hammer? Screwdriver? Wrench?" I just grab the screwdriver and I'm wrenching and hamming in seconds.

    --

    -pyrrho

  159. SC++0x ? by worldcitizen · · Score: 1

    SCO today proudly announced that the version following C++0x will be SC++0x

    Chris Sonnatag and Darl McPride said in an interview to cnet.com.news.com.com.com:
    "We own the C++ language. We can get more royalties and licensing fees after renaming it and charging for every use of the name."

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

      ...shortly followed by "I am above the law!" (bloop...squeek!)

  160. Computationally Complete by Lucas+Membrane · · Score: 1
    That means that it's possible to write a program using templates that compiles legally if and only if Fermat's Last Theorem is false. This will be the ultimate test of the proof of the theorem. However, the time and memory requirements to compile the program are very large.

    One thing that was good in the original Ada standard was that pre-processors were not allowed. Nonetheless, several big shops wrote preprocessors to standardize their code and implement extensions.

    1. Re:Computationally Complete by exp(pi*sqrt(163)) · · Score: 1

      I might just code that up myself. Not too hard actually!

      --
      Doesn't it make you feel good to know that our freedoms are protected by politicans, lawyers and journalists.
    2. Re:Computationally Complete by Q+Who · · Score: 1

      That means that it's possible to write a program using templates that compiles legally if and only if Fermat's Last Theorem is false. This will be the ultimate test of the proof of the theorem. However, the time and memory requirements to compile the program are very large.

      I think that you are a bit confused about computational hardness of various problems. For example, a program that does not compile legally would be an example for a program you talk about (since FLT is true).

      It's also easy to do similar trick for a question you don't know answer for. You just write two programs, one saying "true" and another "false", one of the programs will give the correct answer.

      You see, you need to have an input, such as a graph which the program is supposed to say is 3-colorable or not. :)

  161. external hooks by hey · · Score: 1

    I would like it if C++0x defined a nice way to add on object orientated external libraries. Maybe like COM. Maybe then C++ would finally start building a big warehouse of libraries like Perl has in CPAN. The committee shouldn't be writing specific libraries -- only as examples.

  162. Re:It's great to see some metaprogramming related. by exp(pi*sqrt(163)) · · Score: 1
    I don't care for programmers who are so caught up in their genius...
    Metaprogramming has uses well beyond impressing friends and colleagues. An example: It just paid off for me big time because I was able to make the compiler do the hard work of building the code to differentiate some fairly complex mathematical expressions in order to write some optimization code. The code is compact. It's not too hard to read. As an API it's extremely easy to use and people who don't understand the innards are able to use it. The code is almost untranslateable to C because one line of C++, expands via templates, to a vast amount of code. But this isn't bloat, this is code that computes what I need.

    If you take a look at many APIs built using template metaprogramming you'll find that the primary goal in almost every case is to present an intuitive interface for the end user. Check out Blitz++. It's horrible inside. But the end user gets to write code that looks like familiar mathematical notation.

    However, aside from metaprogramming I agree with your "architecting a space station" comments. People like to build these gigantic hierarchies. The strategy often fails because the goal is to cover ever conceivable situation. Invariably the programmer fails and you're left with an even more complex morass that needs to be fixed to work in your situation. But that's different from metaprogramming and these problems are just as present in C.

    PS In my spare time I'm working on an assembler project at the moment. I expect the final app to fit in under 8K, 4K with luck. I enjoy C++ but I haven't forgotten my roots!

    --
    Doesn't it make you feel good to know that our freedoms are protected by politicans, lawyers and journalists.
  163. exception-enforcement. by alyosha1 · · Score: 1

    Hmm, so I'm not the only one...

    I've often wondered about an 'ultra-strict' compile flag for c++ which would reject any function that propogated exceptions not listed in it's exception specification list. (I guess the implementation would have to check every the specifications on every sub-level function call, or something)

    page 375 of TCP++PL (3rd edition) states that breaking an exception-guarantee, when it exists, generally terminates the program. But this is a run-time solution - I don't see why it can't be made into a compile time solution, apart from trivial little matters like every single library on the planet having to be re-written to correctly specify their exceptions.

    Looking a page ahead in the text, I see that Stroustrup does debate whether no-throw should be the default, and decides that it wouldn't be worth the effort. He's probably right, but if you could do it, it seems to me it would make c++ even more robust than it currently is.

  164. Re:What C++ really needs to do by kingkade · · Score: 1

    OR YOU COULD JUST DECLARE (oops) declare your method to throw the IOException. Either way, whether you have to add extra code for exception handling or whether you have to add code to check if an I/O error occured (and go back until you read a whole line) is probably about the same. Exceptions are just replacing the old way of using return values for error/success events.

  165. Yaaaaaawn! by istartedi · · Score: 1

    "A Proposal to add Regular Expression to the Standard Library"

    This seems typical of the pace at which language standardization moves. How long have standard, free, C (useable in C++) regex implementations been available for those who really want them?

    And ISO-C still specifies no standard library for graphics, networking, regex, or data structures which are respectively satisfied by (numerous APIs), sockets, Henry Spencer, and (roll-your-own).

    So, if any of this stuff ever makes it into the standard, that will just add the extra work of having to write a wrapper around the current solution to make your code "standard compliant". Why bother?

    --
    For all intensive purposes, "whom" is no longer a word. That begs the question, "who cares"?
    1. Re:Yaaaaaawn! by MagPulse · · Score: 1

      This seems typical of the pace at which language standardization moves.

      Of course. Standardization should only happen on things that are widely agreed upon.

      How long have standard, free, C (useable in C++) regex implementations been available for those who really want them?

      Boost, a C++-specific library, has a great regex module.

      So, if any of this stuff ever makes it into the standard, that will just add the extra work of having to write a wrapper around the current solution to make your code "standard compliant". Why bother?

      If your library works on the platforms you're developing for, adding a wrapper won't make it any more standard compliant. However, rewriting it to use the new standard will.

      Yaaaaaawn!

      Nope, standardization is not that exciting.

    2. Re:Yaaaaaawn! by istartedi · · Score: 1

      Boost, a C++-specific library, has a great regex module.

      My question was rhetorical, the point being that regex libraries written using standard-compliant C have been available for at least 10 years, probably longer. The (C) BSD license in my copy of Henry Spencer's regex has 1992 as the earliest date. Since C can be linked into C++, this means that Spencer's regex has been available to C++ too.

      If your library works on the platforms you're developing for, adding a wrapper won't make it any more standard compliant. However, rewriting it to use the new standard will

      If you've used something like regex in multiple modules, it would be silly to re-write all the modules to use the regex that comes with the compiler. Instead, you'd 1. write a wrapper around the regex that comes with the compiler. 2. swap out the include file for the old regex and replace it with the header for your wrapper. 3. stop linking the old regex. In theory, linking the new regex wouldn't be required since it's now part of the standard library.

      Following those 3 simple steps is a lot easier than re-writing all your modules, but it's pointless make-busy work.

      On the one hand, this forms a good argument for standards bodies just sticking with the core language and leaving libraries up to us. OTOH, it's also a good argument for them to put more effort into libraries. A rich set of libraries has always looked like one of Java's strongest points to me. Whatever they do, they shouldn't do it half-baked, which is what it looks like to me.

      It also looks like perhaps they are trying to justify their existance, and make just enough work to keep the current members busy, but not so much work as to achieve something truly magnificent, such as a set of standard libraries to rival Java's.

      --
      For all intensive purposes, "whom" is no longer a word. That begs the question, "who cares"?
    3. Re:Yaaaaaawn! by iendedi · · Score: 1

      And ISO-C still specifies no standard library for graphics, networking, regex, or data structures which are respectively satisfied by (numerous APIs), sockets, Henry Spencer, and (roll-your-own).

      Are you advocating such an abomination?

      --

      It is your personal duty to fight for what is right on a daily basis. Ignoring injustice is identical to approving
    4. Re:Yaaaaaawn! by istartedi · · Score: 1

      Advocating? Sure. However, not as a requirement for a conforming C implementation. Right now we've got two levels of library support in C: Freestanding (IIRC, only stdarg.h and float.h required) and Hosted (full library support required). I have proposed adding a 3rd level of library support: Extended.

      It would help C (and C++) compete with Java. One of the primary appeals of Java is the rich set of "standard" libraries. Unlike Java, nobody would be required to implement or use the extended standard libraries. You could still use DirectX, Windows Sockets, Joe's data structures, etc.

      Alternatively, the ISO could just keep out of all library development and concentrate only on the core. Under such an approach, we wouldn't have the abomination that is complex.h in C99. Instead, we might have something like operator overloading, which would have allowed anybody to implement their own complex.h.

      In other words, no half-a** library standards. Either comprehensive standard libraries, or core specs only. It would certainly provide much easier answers for the people who ask "how do I do graphics" in comp.lang.c every other day.

      SIG CORRECTION: So, wait a second... anybody who works on Linux immediately becomes "IBM's employee" and IBM generously "donates" that person's services for the purpose of spitefully irritating Bill Gates?

      Tell me more about this world you live in.

      --
      For all intensive purposes, "whom" is no longer a word. That begs the question, "who cares"?
    5. Re:Yaaaaaawn! by iendedi · · Score: 1

      If one is smart enough to code in C, one is certainly smart enough to stumble over three hundred and forty seven thousand different bloated monstrosities that we call APIs for everything from graphics to managing Microsoft BOB derivitive bit puppets. If we can minimize the creation of these nasty things, we should do that. Who wants 127 versions of the standard 'C' graphics library besides, perhaps, Microsoft?

      As far as my sig goes? Isn't it obvious?

      In my world, working on Linux isn't working for IBM. It is working for the government of Germany or working for the the liberation of the poor in Asia (allowing them to participate in the technosphere). In my world, IBM generously dumps intellectual property, many man-decades of work and provides services for this same cause. Of course, it further's theirs as well and it frustrates their competition, but in the end, Linux does not belong to them, does it?

      Just think of me as your anti-meme.... That will do just fine.

      --

      It is your personal duty to fight for what is right on a daily basis. Ignoring injustice is identical to approving
  166. Language features I'd like to see... by StevenMaurer · · Score: 1
    In my opinion, there are really only three major features C++ is missing:
    1. An pre/post-fix rotate operator.
    2. A class mechanism to avoid double initialization.
    3. Ability to overload class access operators.

    Everything else can be done within the language. (Actually, a lot could be deprecated - like "protected", which has no good use, IMHO.)

    The class access operator overloading is especially important. Without the ability to overload ".", ".*", "::", and "sizeof", the class designer really can't completely control the behavior of his object under all circumstances. This leads to shared responsibility over the object, which in turn leads to confusion and bugs.

    I could write an extended essay on this latter point, with tons of pattern and anti-pattern examples, but I won't bore you with it here.

    1. Re:Language features I'd like to see... by Anonymous Coward · · Score: 0

      Actually, a lot could be deprecated - like "protected", which has no good use, IMHO

      That's because you're an idiot.

    2. Re:Language features I'd like to see... by Unordained · · Score: 1

      can you give examples of each? (or rather, the last two. 'rotate' is, i think, rather obvious.)

      double initializiation? when have you had that? the only case that comes to mind is when you derive B and C from A, then D from B and C ... and you're supposed to do that a different way anyway (declaring that A is likely to have this happen and be multiply included later, to avoid namespace problems inside D, trying to reference A.) any examples of this happening?

      i'm not sure where you're going with overloading the access controls -- iterators do something similar by overloading the dereferencing operator ... but it retains operations on itself. without that, doing my_itr++ might do ++() on the referenced object ... and you'd have absolutely no control over the iterator itself. at most it'd be a smart pointer.

      i'm open to examples!

    3. Re:Language features I'd like to see... by StevenMaurer · · Score: 1

      Ok, sure. As I said, I don't have tons of time for a discussion that's essentially moot (none of this will ever really get in the standard), but it's fun to talk about anyway.

      What I said "double initialization", I was talking about temporary object instances. C++ can't optimize away implicit instantiations that automatically -- what if the class has a reference count in the (copy) constructor? But if you could add a class/struct modifier that said it was safe to do so, then the compiler could automatically reduce constructs like: "Class C = Class(ptr);" into: "Class C(ptr)" (just to give the crudest example). The same thing for "C = A + B; ", temporary objects in function calls, etc., etc. This way, an intelligent class designer could make it so that people didn't have to remember that C = C + A is less efficient than C += A.

      Overloading the dereferencing operator allows you to create "smart pointers", but it doesn't let you create "smart objects". There is presently no way for the class designer to absolutely control his own interfaces. By overloading the access controls you could, for example, have an object whose size is variable, without all the placement new rigamarole, and without your users knowing about it. You could make a Class that pretended to be a simple value, but actually did very complicated things behind the scenes. You could make a much simpler version of iterators; you wouldn't need things like partial specialization to implement iterator traits, because your iterator could be implemented as a class.

  167. Why not actually talk about the changes by akac · · Score: 1

    instead of the names? This is stupid. Half the people who visit here sound like childish morons. Who cares what its called? I did not come here to read all the "funny" ++c++ jokes. I came here to read a discussion on the merits of all those changes and such.

  168. Boost has Lambda Functions by dbremner · · Score: 1

    Take a look at boost::lambda. There's a proposal to include it in the standard.
    It lets you do the right thing, e.g. :
    for_each(a.begin(), a.end(), cout (1 + _1));

    Not quite as sexy as a functional language, but useful w/minimal overhead.

    --

    Life is a psychology experiment gone awry.
  169. Re:What C++ really needs to do by stonecypher · · Score: 1

    but you don't run across it much in the business world and never have

    That's funny, I do. Or at least I used to. It seems (unfortunately) to be dying. The .NET marketing platform won, no surprise.

    and Perl/Python/Java/VB/tcl will always be better glue then C++

    I'll give you Perl and tcl. Arguably, Python. But VB? Java? Have you ever tried to use Java as glue? Why didn't you name PHP, Lua, bash, etc?

    (PHP is krazyglue. It's got every other language and major app on earth in a hard hat stuck to the underside of the c++ girder. And if you give them money, you get a seriously balls to the wall optimizer. Pity about the way it handles objects, but the way it handles variables almost makes up for it.)

    Java, by the way, was designed to be hardened styrofoam bricks, not glue. Why hardened styrofoam? Because you can use it for support, or a wall, or insulation, or it'll float in water - that is, it runs pretty much anywhere, but isn't great for any of them. If you want it in a small bucket or low gravity (tiny systems) you have to hollow it out (J2ME) and if you want it as a really hardened wall you need to add all sorts of struts and support (tomcat, beans, JavaFeces.)

    Java's a good ideal. It's good for some people. To me, it's like visual studio: it tries to do too much for me, and I don't like it. I'm a control freak. Besides: AWT. (I mean, really, I'd be making fun of swing, but ... AWT? Someone thought that would be a good idea?)

    What I would really like to see in C++ would be compile-time exception enforcement ALA Java.

    Would be nice, wouldn't it? There's a problem: C++ has lots of things that make this outright impossible. I brought this up on #c++ on efNet once, and it was explained to me in a way that made sense for about an hour and fourty five monutes (don't pretend like that's never happened to you.)

    This is an open plea to someone better at C++ than I am: please explain why compile-time exceptions in C++ aren't possible, or alternately explain why I'm wrong.

    --
    StoneCypher is Full of BS
  170. I've got an idea by Anonymous Coward · · Score: 0

    Let's create a working group of industry folks,
    and CHARGE MONEY for the standard, so
    that less and less people use the language,
    write parsers, etc.

    This model has worked before (well, not so much
    for C, but C is simple). So it should work again.

  171. "No major new language features are needed" by Animats · · Score: 1
    Strostrup says that. Remember, this was the guy who left out templates in version 1. Remember all those horrid macro-based schemes for emulating templates? Remember Strostrup's tortured defense of unchecked downcasting, and his opposition to dynamic_cast? C++ postdates Smalltalk and Ada, as well as several object-oriented Pascal variants, so there was no excuse for that. You have to have polymorphism or generics. Pick one.

    On the other hand, most of the proposals for C++ "enhancements" are bad. Most of the "enhancement" proposals are from people who want to program at compile time by abusing the template mechanism. Then the end user is stuck debugging some gonzo template written by somebody who thinks they're l33t. This is not progress. We went through this with LISP, and it's one of the reasons LISP is a dead language.

    But thinking that C++ is OK is a big mistake. The fundamental problem with C++ is that it has abstraction without safety. C has neither abstraction nor safety, so you can get in trouble easily but the problem is usually visible in the source code. Java has both abstraction and safety, but pays a performance penalty for it. C# offers the illusion of safety, with "managed objects", but doesn't really provide it, which is so Microsoft. Strostrup doesn't even mention "safety" as an issue. This is more of that "we're so l33t, we don't need a safe language" attitude that produces a few new buffer overrun vulnerabilties every week.

    I'm being hard on Strostrup here. But we have far too many preventable bugs in code today. It doesn't have to be this way.

    Two years ago, I proposed strict mode for C++. The basic idea is modelled on Perl's "strict mode"; you have to turn it on, but once it's on, the rules are tighter and there are some guarantees about the code not having certain common problems. I don't necessarily endorse that syntax, and I've had some later ideas on how to do this better. But increased safety is the way to go. As a retrofit, I admit it's tough.

  172. Re:WHY DON'T THEY JUST CALL IT C++++ by blibbleblobble · · Score: 1

    "dude, the ^ operator is for XOR, not X^Y"

    Okay, so what's logical XOR?

    and #define xor(a,b) ((a)&&(^b)||(^a)&&(b)) doesn't count, unless you're a secret BASIC admirer

  173. Re:SCO owns nothing but C++rap by Grishnakh · · Score: 1

    RDRAM is not and never was a standard. It's a proprietary memory interface.

    Maybe you're thinking of SDRAM, which really is a standard (approved by JEDEC). The RAMBUS patents pertaining to SDRAM caused several court cases, including charges of fraud against RAMBUS itself. I haven't heard what's finally happened with that.

  174. Does This Mean.... by g_goblin · · Score: 1

    The gcc will finally be able to compile templates correctly without a serious performance hit?

    -- I smell varmit puntang -- Carl Spangler

  175. What C++ REALLY needs is to by Anonymous Coward · · Score: 0

    drop primitive data types.

    Every data type becomes an object - Integer for int, Character for char - all dervived from a single master data object type.

    1. Re:What C++ REALLY needs is to by trouser · · Score: 1

      And then we could change the name of the language to ++ since it would no longer be a superset of C.

      --
      Now wash your hands.
  176. Still need 7 lines for an encapsulated attribute by Anonymous Coward · · Score: 0

    What is weird to me is that every OO language that I have seen still needs seven lines of code to make an encapsulated attribute:

    int x;
    int getX() {
    return x;
    }
    void setX(int x) {
    this->x=x;
    }


    Is it not time we do this a litle bit smarter? For example as:

    getable setalbe int x;

    This would seriously limit the number of lines needed in C++ (and other OO languages), which would make it alot faster to write. Furthermore, and more importantly it would be easier to read as it is easier to get an overview of 50 lines than 100 lines of code.

  177. What C++ should borrow from Java by Anonymous Coward · · Score: 0
    Some Java features which are really needed in C++:
    • An overall consistent package concept. It's possible to emulate a that feature by using namespaces and writing sophisticated Makefiles. However, the syntax of nested namespaces is putrefactively ugly and Makefiles are a real PITA... Speaking of packages, a 'package' modifier would be nice (like 'public', 'private' etc.)
    • Reflection! Definitely one of the best features of Java, it vastly simplifies many tasks (e.g. everything which has to do with dynamically queried object attributes). That's a step away from static typing, can be very useful at times.
    • Dump the header files! Header files make refactoring really tedious. Why not place interface information in the *.o files like in Java?
  178. It might have been called "P" by gotr00t · · Score: 1
    Both C and its successor C++ were based on the language B, which was based on the language BCPL, devised even before the first version of UNIX.

    When C++ came out, there was some debate over whether it should be called C++ or P, as P is the letter after C in BCPL.

    Therefore, it would be more logical to call the new language L instead of D, E, or F.

    1. Re:It might have been called "P" by Nevyn · · Score: 1
      Both C and its successor C++ were based on the language B, which was based on the language BCPL, devised even before the first version of UNIX.

      But before C++ perl came along and took PL, so the only thing left was the '\0' ... which is about right for the language.

      --
      ustr: Managed string API with ave. 44% overhead over strdup(), for 0-20B
  179. Re:Whatever. by Watcher · · Score: 1

    This may be naive, but couldn't you just cut and paste your previously used linked list.

    Well, you can cut and paste code, and that happens quite often in this world (one project here has 400 controls that perform various functions, and most of them are based off of a cut and pasted code template. Talk about a maintenance nightmare!). However, there is one huge problem with cutting and pasting code: if there is a bug, you will have to fix it everywhere you have copied that code. That's the big benefit of implementing a generic container class in a dynamic library-if you find a bug in your code, you fix it one place and the fix propagates to all applications using that library.

  180. Been there, done that, have the compiler by devphil · · Score: 1


    Point by point, then.

    1. Not quite sure what you mean by "allow code-generation at compile time," since that's exactly what template functions allow. Also, C++ is already the only mainstream language which permits execution of semi-arbitrary code during compilation, making it a compile-time Turing machine in addition to a run-time Turing machine (which is what everything else is). Think recursive templates or take a look at the Alexandrescu text, you'll see what I mean.

    2. You probably won't see continuations, but you might see closures. Those tend to destroy performance and can be tricky to implement correctly on oddball hardware. But some changes to the language (relaxations of existing rules, mostly) have already been proposed, specifically to ease the implementation of lambdas.

      The existing language already permits things awfully close. Local anonymous classes with static functions, for example, come very close to local functions. Also, check out the Boost lambda library.

    3. Many compilers already support __typeof to do type inference.

      As for your "so surprised that languages still make you do stuff like foo i = new foo;", I think you were absent the day the taught "Basics of Object-Oriented Design." Given two classes, Base and Derived, fill in the blank:

      ____ i = new Derived;
      (Hint: no matter what you guess, the programmer really meant "the other one".) Now, how is a compiler supposed to guess, if you can't?
    --
    You cannot apply a technological solution to a sociological problem. (Edwards' Law)
    1. Re:Been there, done that, have the compiler by be-fan · · Score: 1

      Not quite sure what you mean by "allow code-generation at compile time," since that's exactly what template functions allow.
      >>>>>>>>>
      Yes, it allows this. In a ugly, hackish manner. See Lisp macros for a mechanism that is much cleaner, has no performance disadvantages (C++, of course, would ban code generation at runtime) and is much easier to use. Also, read up on the metacode extension proposal. Heck, even Alexanderscu admitted he was rather fond of Scheme macros on comp.lang.c++ :)

      The existing language already permits things awfully close. Local anonymous classes with static functions, for example, come very close to local functions. Also, check out the Boost lambda library.
      >>>>>>>>
      Local anonymous classes are still too "out of line" for my taste. One of the nice things about lambdas is that they save you quite a bit of typing. Declaring a local class requires far too much boilerplate to be a useful replacement for real lambdas. And the BLL is cool, but isn't really usable thanks to the hidiously complicated error messages it causes the compiler to generate. The error message bears zero resemblance to the actual code, and is essentially an AST written in particularly ugly template syntax.

      ____ i = new Derived;
      (Hint: no matter what you guess, the programmer really meant "the other one".) Now, how is a compiler supposed to guess, if you can't?
      >>>>>>>>>
      It doesn't matter what the programmer meant. The type of 'i' is Derived. Type inference isn't complicated. The type of the object is whatever the type of the right hand side expression is. Also, type inference isn't terribly useful for OO code. Where pointers to base types are common. However, C++ is a multi-paradigm language, and type inference makes dealing with code that focuses mostly on value types. The STL is very value-type oriented, and if you follow the style it naturally engenders, you'll end up writing code that may not use operator new or polymorphism or inheritence a single type.

      --
      A deep unwavering belief is a sure sign you're missing something...
    2. Re:Been there, done that, have the compiler by devphil · · Score: 1
      It doesn't matter what the programmer meant. The type of 'i' is Derived. Type inference isn't complicated. The type of the object is whatever the type of the right hand side expression is. Also, type inference isn't terribly useful for OO code. Where pointers to base types are common. However, C++ is a multi-paradigm language, and type inference makes dealing with code that focuses mostly on value types. The STL is very value-type oriented, and if you follow the style it naturally engenders, you'll end up writing code that may not use operator new or polymorphism or inheritence a single type.

      You still didn't answer my question: What is the compiler supposed to guess for the blank?

      Yes, I agree that type inference is not difficult. I disagree that it's "not terribly useful" for OO code, but that's beside the point. What should the compiler actually do when faced with the code above?

      If your answer is, "print error: type inference may not be used with any kind of inheritance and fail to compile," then say so. :-)

      As for the rest of your note, I dont agree with all of it, but I don't disagree with all of it, either. However, this is the first day without thunderstorms we've had here in 10 days, so I'm going outside for as long as I can. Longer responses will have to wait.

      --
      You cannot apply a technological solution to a sociological problem. (Edwards' Law)
    3. Re:Been there, done that, have the compiler by be-fan · · Score: 1

      You still didn't answer my question: What is the compiler supposed to guess for the blank?
      >>>>>>>>>
      Didn't I? -->
      "It doesn't matter what the programmer meant. The type of 'i' is Derived."

      Type inference will assign the left-hand variable whatever the type of the expression on the right hand is. It's a simplification of how type inference in languages like OCaml work, anyway. If the programmer wants to make a base pointer to Derived, he can always just do:
      Base* i = new Derived;
      For OO-style code, he should probably put type declarations in anyway. However, C++ isn't just for OO style code, and for those cases, type inference allows the benifets of static typing without all the micromanagement of static typing.

      --
      A deep unwavering belief is a sure sign you're missing something...
  181. Return type sensitivity would rock by harborpirate · · Score: 1

    Thats actually a use for return type sensitivity that I hadn't thought of, but that'd be really cool. Being able to overload a function with different return types, however, I've wanted many times.

    Being able to do so would be extremely powerful, you could do all sorts of useful things.

    For instance, even something as simple as returning an int or float from an overloaded Average function based upon what the user wanted back:

    public int Average(int a, int b)
    {
    return a*b/2
    }

    public double Average(int a, int b)
    {
    return double(a)*double(b)/2.00
    }

    int intAverage = Average(1,2);
    double doubleAverage = Average(1,2);

    And hey, that's psuedo code so don't get all syntax freaky on me!

    It'd be sweet if that worked in the major languages, I think right now it'd certainly be my top request for language enhancements...

    --
    // harborpirate
    // Slashbots off the starboard bow!
    1. Re:Return type sensitivity would rock by Nynaeve · · Score: 1

      "Being able to do so would be extremely powerful"

      Ahh, but power corrupts. I see this as a design issue, not a code issue. That is, I would code your (apparently java) example above as

      public int AverageAsInt(int a, int b) ...
      public double AverageAsDouble(int a,int b) ...

      simply because it makes the code more readable, and readily understandable by someone else. For example, in the following example, which form would someone read faster (and with less risk of misunderstanding):

      public double Average(double a, double b) ... ...
      Average(Average(1,2),Average(3.0,4))

      How "Average(1,2)" is interpreted (although you'd rightly expect a compile-time error) is a big difference, mathematically.

  182. Re:What about Microoft? by Anonymous Coward · · Score: 0

    Shouldn't MS take a hint and name their upcoming OS "XP0x" ?

  183. Re:It's great to see some metaprogramming related. by greggman · · Score: 1

    Metaprogramming in C++ is one big hack!!!!!! Give me a break, stacking things up in the compiler just to hack together type lists? Frikking fix C++ so that it does this stuff naturally or switch to Lisp which gives you the entire language in which to do meta programming instead of hacking together crap in a system that was clearly never designed to be used that way.

  184. Re:Uh, no. Times two! by Anonymous Coward · · Score: 0
    B wasn't named after BCPL, it was named after Ken Thompson's wife Bonnie.


    That's from Wikkiepedia, and straight from Ken Thompsons mouth, at my aunts wedding (he was the best man.) So, plbbbbbbbbbt, I win!

    :-)


    http://www.wikipedia.org/wiki/B_programming_lang ua ge

  185. Making C++ easier to learn by metamatic · · Score: 1

    If you want a standardized object-oriented C that's easy to learn, it already exists. It's called Objective-C.

    --
    GCHQ Quantum Insert installed. If only our tongues were made of glass, how much more careful we would be when we speak
    1. Re:Making C++ easier to learn by Anonymous Coward · · Score: 0
      Objective C is not standardized. It is arguably the least portable commonly used programming language on the planet right now. NeXT/Apple/gcc's run-time requires static typing; POC and Stepstone don't support static typing. POC's run-time requires blocks; gcc doesn't support blocks. The list goes on and on.

      Basically, anything even slightly complex in Objective C will be incomptible from gcc to POC or vice versa.

    2. Re:Making C++ easier to learn by metamatic · · Score: 1

      NeXT/Apple/gcc does not require static typing.

      --
      GCHQ Quantum Insert installed. If only our tongues were made of glass, how much more careful we would be when we speak
  186. Lesson 1 by Gorimek · · Score: 1

    Yeah, but I think the number one thing that Java did right was to start over. Most of the problems of C++ comes from the decision to be C compatible.

    So if C++ wants to learn from Java, it should start over. But then it wouldn't be C++ anymore. Actually, you might as well use Java... Except that the focus of the new language should be performance, since that's really the one substantial advantage C++ has over Java.

  187. Isn't it obvious? by Gorimek · · Score: 2, Insightful

    but then what's the point of overloaded operators?

    Well, I think the obvious answer is: NONE

    I'm sorry, but operator overloading is one of the most gratuitous and depraved features to make it into the language. And it's not just needlessly pretty, but causes all kinds of subtle errors. From not being able to be sure what "a + b" actually does, to disabling the guaranteed evaluation order in boolean expressions.

    1. Re:Isn't it obvious? by be-fan · · Score: 1

      From not being able to be sure what "a + b" actually does
      >>>>>>>>
      That's a BS argument you always here from the Java folks. You can't overload operator+ for built-in types, so you're *always* sure what a+b does. If a and b are both built-in types, it does an addition. If one isn't a built-in type, you have to go look at the definition to see what it does, or trust that it implements something along the lines of an addition. In this manner, it is no different than:
      a.addTo(b).
      Sure, addTo() seems like its adding 'a' to 'b', but is it? You can lie just as easily with named functions as you can with overloaded operators.

      --
      A deep unwavering belief is a sure sign you're missing something...
    2. Re:Isn't it obvious? by Jeremi · · Score: 1
      Like any powerful feature, if used poorly operator overloading can screw you over. Used well, however, it makes code much easier to understand.


      For example:


      Matrix a = b*(c+d-e)/f;


      is much easier to read, write, understand, and debug than:


      Matrix a = MatrixDivide(MatrixMultiply(b,MatrixSubtract(Matri xAdd(c,d),e)),f);


      (Note: any errors in the above line merely serve to prove my point ;^))

      --


      I don't care if it's 90,000 hectares. That lake was not my doing.
    3. Re:Isn't it obvious? by Anonymous Coward · · Score: 0

      That's a BS argument you always here from the Java folks.

      Don't you mean a B.A. argument? No one I know of who graduated with a B.S. would dream of using Java. Christ, we were all taught assembly and machine level code for some architectures. B.S.'s using Java.. ha! Might as well try writing an OS in Flash!

      A.c.

    4. Re:Isn't it obvious? by be-fan · · Score: 1

      C'mon. Its not nice to put people down. BA's are human beings, just like us, just with different priorities. Hell, if I weren't an Aerospace major, I'd be an English major :)

      --
      A deep unwavering belief is a sure sign you're missing something...
    5. Re:Isn't it obvious? by Anonymous+Brave+Guy · · Score: 1
      I'm sorry, but operator overloading is one of the most gratuitous and depraved features to make it into the language.

      Since you've just provided the Boilerplate Objection(TM), perhaps I should provide the Boilerplate Rebuttal(TM).

      You cannot redefine operators over only fundamental types, so the "don't know what it does" argument is pretty poor. Sure, someone writing their own type can provide a silly version of operator+ that doesn't do what you'd expect, but hey, they can do that with addTo() as well. Maybe we should make like Java, though, where operator overloading is OK as long as the language does it (String's + concatenation operator) but not for anyone else?

      Granted, allowing the overloading of || and && without providing for shortcut evaluation was probably a mistake, and I've never seen anyone try to use it; in fact, several well-respected C++ style guides explicitly warn against it. OTOH, the streams syntax in C++ using << is a more positive example of using operators in innovative ways because op-overloading lets you. (OK, the C++ IOStreams system is superficially clever but deeply flawed, but that's a different matter.)

      The killer, though, is that without operator overloading, you can't write types that work well with generic algorithms, which renders generic programming pretty difficult. Considering that GP is one of the most promising areas of C++ development, and the combination of templates, operator overloading and other related features is behind a lot of the most useful libraries now available, I think your obvious answer is obviously wrong.

      And, after nearly a decade of programming C++, I'm still waiting to see in practice one of these crippling "subtle errors" that I keep hearing about in theory. Somehow, I've managed never to find the library where a+b calls Reformat(WITHOUT_ASKING), I guess. :-)

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  188. Re:Uh, no. Times two! by s-orbital · · Score: 1

    Does that mean that "C" is short for Connie?

    --
    Patent: from Latin patere, to be open
  189. biggest enhancement is to kill it by Splork · · Score: 1

    and admit that c++ was all a mistake. demand a full apology!

  190. Re:Still need 7 lines for an encapsulated attribut by ZamesC · · Score: 1
    getable setable int x;

    Um... And how is that different than just making x public?

    (OK, I guess it's a bit different if you just use one of the attributes, instead of both, but it's still doable with something like:

    ReadOnly<int> x;
    (definition of ReadOnly left as an exercise for the student).
  191. Why remove? by niom · · Score: 1

    I don't understand why people get so obsessed with features they don't like that they always want those features removed. It's like they can't bear that those features even exist.

    So maybe you don't like templates, operator overloading or something else. Who's forcing you to use them? If you don't like them, don't use them in your code. If you direct a group of programmers, warn them whoever uses those features will be fired, and use grep to be sure they comply. Just forget those features exist and let them stay for the rest of us.

    Perhaps the "let's remove features" crowd should spend some time with the Ada programming language. Its extreme inflexibility by design (which is supposed to provide safety, though I don't buy it) gets constantly in the way of good, elegant, efficient implementations. I'm always angry that some perfectly sane and useful language feature that would be very handy in implementing my code doesn't exist simply because the language designers didn't deign to deem it worthy.

    Different programming problems and styles need different language features. C++ can be applied to a much broader problem scope than Java thanks to its greater featurefulness. C++'s complexity shouldn't bother you unless you are in the business of developing C++ compilers.

    --
    -- Repeat with me: "There is no right to profits".
  192. I'd rather have C# with templates by 73939133 · · Score: 1
    I'd rather have C# with templates. C# has eliminated most of the cruft in C++ without adding significant overhead. The only important feature that's in C++ but not in C# is templates. C# still retains all the abilities to access every bit of memory and perform unsafe operations. However, unlike C++, safe and unsafe operations are operations that can be distinguished lexically.

    C++ templates have turned out to be surprisingly powerful and useful. C++ templates are not at all like generics in other programming languages because C++ templates respect overloading. That means that template instantiations may do completely different things for different classes. On the one hand, that requires extra care to avoid bloat during expansion, on the other hand it enables expressiveness that is unavailable in just about any other language. I hope Microsoft won't make the mistake of adding a watered-down generics facility to C#, instead of full template support.

    If people want to beat C++ into shape, I think here are some things that would have to be done:
    • Add a notion of "safe" compilation units, compilation units in which all unsafe operations (pointer dereferencing, pointer subscripting, some uses of the reference operator) are prohibited. (How do you get anything done? You use data structures that are internally using unsafe operations but are externally safe.)
    • Require the presence of a garbage collector in every C++ implementation.
    • Improve reflection features.
    • Make error and bounds checking mandatory and the default in all standard libraries, in particular the STL, but provide options or operations that allow the user to turn off error checking selectively.
    The biggest reason for not using C# for everything for me is that stupid virtual machine; Microsoft's CLR and Mono seem ever more eager to copy the sluggish startup times of the Java JVM. And, frankly, I don't give a damn about being able to move byte codes across architectures, so why should I pay the overhead?

    If we had a native compiler like gcj for C#, I'd probably be using C# for everything.
  193. Re:Uh, no. Times two! by cpeterso · · Score: 1


    and "D" is short for Donnie?

  194. Re:It's great to see some metaprogramming related. by Q+Who · · Score: 1

    But with metaprogramming C++ becomes an entirely new system. The template system is computationally complete (see here for what that means) and so important work can be shifted to compile time. [...]

    While I agree with your post, note that the same (and in much more native and generic way) is provided by Lisp. What C++ does is making metaprogramming type-safe.

    See, for example, this "confession" by Andrei Alexandrescu.

  195. I totally agree, the preprocessor must go! by Anonymous Coward · · Score: 1, Interesting

    The preprocessor is a kludgey hack and needs to be reengineered out of the language. What benefits do we get with the preprocessor:

    1) macros definitions to reduce the execution time overhead of a function call.
    2) constants in the form of #define
    3) the ability to conditionally compile code

    A modern c/c++ compiler covers all of these cases by:

    1) inline functions, in place of macros and all their evil side effects.
    2) const, in place of #define
    3) throwing away unreachable code during code generation, in place of conditional compilation. Granted you still pay the compilation cost, but the execution costs are negated.

    1. Re:I totally agree, the preprocessor must go! by Anonymous Coward · · Score: 0

      1) inline functions, in place of macros and all their evil side effects.


      Not possible for everything. Have you ever tried to use a function which uses an input for both an identifier name and a string? Thought so (## is your friend).


      2) const, in place of #define


      That's fine unless you try to change it's value, or give it a different value in different circumstances... const can only be used for one thing, while #define's have a couple different uses.


      3) throwing away unreachable code during code generation, in place of conditional compilation. Granted you still pay the compilation cost, but the execution costs are negated.


      Unless it doesn't compile at all, in which case... what do you do then? Also, the #define can be given to the compiler on the commandline, depending on external decisions. How do you do that with a const?

  196. Successor to C++ by Anonymous Coward · · Score: 0

    I thought the successor to C++ was called Java.

  197. Re:What C++ really needs to do by Anonymous Coward · · Score: 0

    Exceptions are just replacing the old way of using return values for error/success events.

    And that's one of the drawbacks of the Java libraries. They think of exceptions as a way to return values from functions, rather than returning values or having "out" parameters. And thus the throw/catch turns into a non-local goto.

    Exceptions should be _exceptional_, not routine and expected results of a function. A disk I/O error when your hard drive crashes is exceptional. Running into EOF while reading a file is not.

  198. Terrible article title by dmccarty · · Score: 1
    I'm not sure if Michael did that on purpose to make it look like l33t h4X0r speak but it's not C+ +0x. If he had bothered to read the .pdf he would've seen that's it's "C++0x": it's on the front page.

    As others have pointed out, a la previous languages like FORTRAN, Algol and LISP, it refers to C++ and the year the spec is expected to be completed--in this case, (20)0x.

    --
    Have fun: Join D.N.A. (National Dyslexics Association)
  199. * yawn * -- Whatever by Pedrito · · Score: 1

    I'm sorry, but I've seen the light and man, it sure it isn't C++. I thought C++ was this great thing, only to be bogged down with stuff like keeping header files in sync with implementation files. Get rid of that, and I might consider returning to C++.

    C# is the language for me. Man, it takes all the great stuff of C++ and gets rid of all the hassles. foreach() loops make sense. Multiple inheritance of implementation is a trainwreck. I'll grant there are a few little annoyances with C# (like having to mark members as override, or with new [keywords should only have 1 meaning in my book]). But, C++ has TONS of them. I've coded in C++ for 8 years. I've gotten more done with C# in the past 6 months (including learning the language) than I have in my previous 2 years of C++ coding.

    Sorry, but I'm never going back to C++, if I can possibly avoid it. And no, I don't like Microsoft anymore than anyone else here.

  200. (C++)++ by msoori · · Score: 1

    >somebody else already proposed (c++)++ , which is a reasonable suggestion...

    The problem with (C++)++ is that while C++ would increment value of C by 1, (C++)++ would still increment the value of C by 1. Since (C++) yields a new value that gets stored back in C, that value will again be incremened by 1, but it never gets stored back into C, so (C++)++ would still yield the same value for C as C++, even though an annonymous temp stack variable would have a value 2 higher than original C!

  201. F*** Sonny Bono and b***f*** Cher by yerricde · · Score: 1

    to the tune of supercalifragilisticexpialidocious.

    No. Michael Eisner's copyright lawyers would kick their a**es in a court of law.

    --
    Will I retire or break 10K?
  202. So in summary, C++ is pointless by Morgaine · · Score: 1

    So to summarize all the responses to Karma_Sucks's thread, C++ is basically pointless.

    As most of you agree, it has lots of pretty features (even the advocates agree that it's got *too* many though), and it's incredibly versatile (although even the advocates agree that in some areas it's *too* versatile for its own good), and it allows the compiler to optimize better (except that language complexity results in most programs being a lot slower than necessary because of all the unexpected and unnecessary temp constructions and destructions), and it's got excellent overloading (except that the gotchas increase semantic complexity a hundredfold and the rest of the time overloading confuses the newbies), and it's fully object-oriented (except that it's not since the encapsulation is only class-based) .... so, er, what exactly were the pro's?

    I'm speaking as a long-term C++ developer, but (clearly) not as an advocate. I've just seen too many commercial projects die through using C++, mainly because the team's project management skills were not up to the challange of using such an extraordinarily complex language. When I say "die", I mean it has cost the companies millions of dollars each time.

    I've also seen it succeed, magnificently, just once. But the management on that project was absolutely brilliant, exceptional. It is not the norm.

    C++ has a few good things for lone developers. Pure and simply though, C++ is dangerous on typical commercial projects. YMMV.

    I agree with the parent post (but not from a Java standpoint, as that language has a lot of silliness too): to improve C++, remove 90% of it.

    What we really need is a C+.

    --
    "The question of whether machines can think is no more interesting than [] whether submarines can swim" - Dijkstra
  203. I have a suggestion.... by Anonymous Coward · · Score: 0

    How about getting rid of some features for a change?

  204. It's because features interact by Anonymous Coward · · Score: 0

    The trouble with not removing features is that they interact with each other. Each time you add something or modify a semantic somewhere in the language, it has an impact on all those rarely used features that you've just left lying around for old times' sake.

    This happened repeatedly during C++'s growth from its early "C with Classes" origins to the abomination we know now. Overall language semantic complexity explodes each time something is added that has more than a local impact, and that occurred again and again, which is why C++ is now the most complex language in existence. Virtually nobody has the 5 years and IQ of 200 to understand it fully (just too many nooks and crannies).

    Suggesting that things be removed is just an exercise in survival.

  205. b, c, PLUS, l by yerricde · · Score: 1

    or whether C followed B because it was the next letter in BCPL (in which case C++ would have been P).

    P is for "Plus". C++ is pronounced "C Plus Plus".

    Or perhaps you simply still think of C++ as "C with more type checking, and those // comments."

    No, that's "gcc -Wall".

    --
    Will I retire or break 10K?
  206. All your legs are belong to us!!! by Anonymous Coward · · Score: 0

    Oh stop that! It's a feature that the trigger is permanently on in C++. If your leg got blown off because you were on the same continent, that's your own fault!

  207. Name by PDP-11_Forever · · Score: 1

    How about c^2? (C squared)

  208. It's always been there by Anonymous+Brave+Guy · · Score: 1
    I think what C and C++ really lack is the option to turn on array range checking.

    You shouldn't be using raw arrays in anything except low level code anyway. For higher level code, it's almost invariably better to use a container class, be it vector, map, a matrix class of your choice, or whatever.

    If you're using vector, there is already an at() method that checks the index. It should perhaps have been the "default", rather than making the overloaded operator[] the non-range-checked one and at() the safer alternative, but it's a bit late to fix that now; the feature is, and always has been, there, though.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    1. Re:It's always been there by ZorbaTHut · · Score: 1

      I, personally, went into the STL headers and added a #define to range-check operator[]. I turn it on when I'm willing to take the speed hit and turn it off otherwise.

      Headers aren't sacred. :P

      --
      Breaking Into the Industry - A development log about starting a game studio.
  209. Answers of questions, summary of new features by lkaos · · Score: 1

    First of all, the discussion so far has been pretty immature.

    To answers the most common question (why name C++0x), the name of the language is still C++. For standardized languages, it's common to refer to the different dialects by their 2-digit year extensions. Such as C89, F77, C99, etc. The use of C++98 and C++0x are merely used to disginuish the language at that particular standard.

    Most of the library features of the new standard are already in the Boost library. Things like threads, regexs, smart pointers, are all there.

    The smart pointer is actually one of the most highly debated topics because a stronger smart pointer is easy to implement but requires a new language feature (and even though this feature is likely to make it in, there's a requirement that all proposed libraries not required additional language features).

    The focus on the new standard is really expanding the standard library (the goal is a library for C++ as useful as the ANSI library for C). Since C++ is committee based though (unlike Java), it takes a long time for these things to happen since it involves comprimise between many strongly-opinionated smart folks.

    On the one hand, the language evolves slowly, but on the other hand, when it is ready, it will be a beautiful thing.

    --
    int func(int a);
    func((b += 3, b));
  210. Shouldn't this article be in Hindi? by Anonymous Coward · · Score: 0

    Bengali or Urdu? Afterall, all the programming jobs are going to India anyways.

  211. one problem by Anonymous Coward · · Score: 0

    However, making that standard in the language is a terribly bad idea for one simple reason: what you have outlined is not the standard definition for multiplication. You have defined element-by-element multiplication, not matrix multiplication. For a matrix, that is incorrect. For an array, it might be right. Either way, there are multiple definitions that make sense, so defining either one as standard cannot be correct.

  212. Re:What C++ really needs to do by Anonymous Coward · · Score: 0

    Lol. That's funny dude. The compiler forces it to be correct! Lol. Take a look at any big piece of java code and count the number of occurences of structures like:

    try { // Lots of complicated stuff
    }
    catch (SomeException e) {
    }

  213. My (upwardly-compatable) proposal. by Ungrounded+Lightning · · Score: 1

    I have wanted a tightening of a certain portion of the spec since ANSI's deliberations on the first standard. (Actually, I think I corresponded with Bjarne about it even before then.) I'll paraphrase it here (rather than spending time to put it into correct standard-ese).

    1) Beginning with the execution of the first user-written statement of a constructor of the most-baseward class where a virtual function is defined, and ending immediately after the execution of the last user-written statement of that class' destructor, it shall be explicitly legal to call the virtual member function via a "this" pointer (or a copy of its value in an appropriate pointer type).

    (This may be done even from code which has no special relationship to the object, other than knowlege of the value of a pointer to the instance and enough of the class' declaration to use it to call the virtual function.)

    2) When a virtual function of a base class is overridden by a new definition in a derived class, such a call will execute:
    a) The base-class version if performed before the exectuion of the first user-written statement of a constructor of the derived class.
    b) The derived-class version if performed during or after the execution of the first user-written statement of the constructor of the derived class and before or during the execution of the last user-written statement of the destructor of the derived class.
    c) The base-class version if performed after the execution of the last user-written statement of the desctructor of the derived class.

    In particular: If such a call is made during the construction or destruction of member variables or objects of the derived class, the base-class version of the virtual function (if such is defined) is the one executed.

    = = = = = = =

    In a vpointer implementation this would correspond to the storing of the derived class vpointer as the last action before executing the body of the constructor, and storing the base class vpointer as the first action after executing the body of the destructor.

    = = = = = = =

    This is not a frivolous, nit-pick.

    Making this change enables such functionality as base classes registering their instances during construction, with the behavior of the instances being appropriately promoted as they are built up, even if the behavior happens to be invoked during construction or destruction.

    For example: Mark-and-sweep garbage collection of C++ objects can be built using a base class for garbage-collectable objects containing a virtual member function to encode knowlege of the derived object's pointers to perform the marking phase. But without the guarantees of this proposal, constructors and destructors of member objects (and even the containing class itself) become VERY limited in the complexity of behavior they can exhibit, since they must not allocate memory in a way that might preciptiate a garbage-collector activation.

    Even absent this (and other) concrete example(s), the proposal would tend to make classes more flexible and less error-prone, because virtual functions become available during construction yet the derived class versions can't be invoked unless the derived class members (and the class itself) are initialized but not finalized. (With this guarantee the only issue of invoking a member of a partially-constructed class is within the class' own constructor and destructor, where it can be handled by programmer care. Without it the member objects may invoke derived class behavior on an uninitialized level of the object, or fail to perform necessary actions appropriate to the current level).

    The proposal is upwardly-compatable because it simply tightens requirements on a subset of already allowed behavior. (The first ANSI C++ standard explicitly gave no guarantee of which overriding of virtual member functions would be invoked by a member object constructor or destructor of functions it called, while the revised standard didn't guarantee that EITHER would be invoked - essentially saying "Don't call them from there. Anything might happen.")

    --
    Bantam Dominique roosters crow a four-note song. Once you've heard it as "Happy BIRTHday" you can't NOT hear it that way
  214. Re:Uh, no. Times two! by Anonymous Coward · · Score: 0

    Yes, but as has been remarked, Ken is famous for pulling the leg of unsuspecting dolts like yourself.

  215. Vector , Valarray by dbretton · · Score: 1

    I got one! Valarray should be called vector and vector, valarray.

    After all, valarray is the one with the vector operations built into it! Hell, even Stroustrup commented about this in "The C++ Programming Language", and he created the damn language!

  216. Re:Whatever Indeed. by Anonymous Coward · · Score: 0

    As the self-professed finder of the fortran "gems of knowledge" you are worthy of tribute and adulation ya know... oi polloi to learned patrician.

    Where may we, to whom the gods don't speak, direct our tithes?

    I'm gonna use what you use from now on.

  217. E is already taken by CausticWindow · · Score: 1

    It's one of Wouter van Oortmerssens many languages.

    The logo is a nice little mdma e.

    --
    How small a thought it takes to fill a whole life
  218. Re:Sig by Anonymous Coward · · Score: 0

    No, gentlemen are all about screwing the employees through non-verbal communication.
    My pointy-haired boss wrote the book for the Mona Lisa school of project (mis)management.
    But, hey, no angst here...

  219. It really should be called by BoomerSooner · · Score: 1

    C++ aught x.

    I cannot wait to tell my grand & great grand kids stories about aught (sp?) three like my great grandparents did.

    1. Re:It really should be called by kantor · · Score: 1

      Who gives a fuck what you will tell your little bastards ( assuming you even survive long enough to have some ) ?

      You are insignificant ...and frankly, as far as I am concerned you don't even exist.

  220. Re:SCO owns nothing but C++rap by thirdrock · · Score: 1

    IBM's did not comment on SCO's latest suit but instead issued a statement.
    "All we needed to deal with the SCO threat was some sharks with frikkin lasers on their heads. Is that so hard? Really?"

    --
    >>
    I am the director, and this is my movie ...
  221. Why not Eiffel? by javabandit · · Score: 1

    After reading some of these proposed features, I have to question why people would not use one of the already engineered languages.

    The great example is Eiffel. Eiffel basically has every thing that you could possibly want in an OO language. Its design by contract features are pretty much unsurpassed. Polymorphism. True covariance. The whole nine yards.

    I have used C/C++/Java pretty much my entire career. But after dabbling in Eiffel, it opened my eyes that C++/C are not the end all be all of languages. In fact, it seems to me that C++ was striving to be more like languages such as Eiffel.

    I guess old habits die hard... which is why we stick with C++, Java, and the like. It also stands to reason why we continue to try to enhance C++ into different, more robust forms (Objective, D, etc).

    But after using Eiffel for a few years now, I can say that I think it is highly superior to C++ in so many ways. But the big lacking it has is in its libraries. Eiffel simply has nowhere near the library support of C++, Java, or Python.

    Anyways... I'm rambling here... but I wanted to put a plug in for Eiffel. For those who want a taste of something different.

    1. Re:Why not Eiffel? by trouser · · Score: 1

      Objective C is not an attempt to enhance C++. It is an object oriented extension to C which borrows a lot of good things from Smalltalk.

      --
      Now wash your hands.
  222. oohh by autopr0n · · Score: 1

    How can I get me one of those numberals?

    /adds another joke to the heap. Get it? heap?

    seriously though, this thread is like some sort of nerd version of fark.com :P

    --
    autopr0n is like, down and stuff.
  223. Better then any joke in the threads... by autopr0n · · Score: 1

    Is page 6 of the PDF, the bullet point says "Remove embarasments" :P

    --
    autopr0n is like, down and stuff.
  224. Re:Whatever. by Anonymous Coward · · Score: 0

    Oh, shut up. Typedef a struct with some data & function pointers, then have a "new" function to spit out freshly built structs.

    It doesn't take any significant amount of time more or less than writing a C++ class, and you've got an object without the overhead of an OO language.

  225. Re:Whatever. by Anonymous Coward · · Score: 0

    And you can swap out those functions at will, too.
    Very nice for, say, changing the comparison function when walking a B+ tree full of said structs. You can then search on any criteria and not need to bog the search down with numerous compares in the tree-walking code.

  226. Re:Whatever. by Anonymous Coward · · Score: 0

    Your mom is of the opinion that my crotch is superior.

  227. Re:SCO owns nothing but C++rap by bucky0 · · Score: 1

    Ooops, my bad. I could've sworn I remembered Rambus doing that to RDRAM and then getting away with it, which caused the industry to move towards the more-cheaper (yes, I know) DDRAM

    Thanks for the correction.

    --

    -Bucky
  228. Core and extensions by yerricde · · Score: 1

    Understand that anything written into a language standard must be implemented by everybody

    Then create a multiple part standard: C++ Core, C++ Streams, C++ STL, C++ Bounds Checking Extensions, and what have you. Most compilers would include Core, Streams, and STL at a minimum because C++98 defined them.

    --
    Will I retire or break 10K?
    1. Re:Core and extensions by GlassHeart · · Score: 1
      create a multiple part standard: C++ Core, C++ Streams, C++ STL, C++ Bounds Checking Extensions, and what have you. Most compilers would include Core, Streams, and STL at a minimum because C++98 defined them.

      That doesn't improve the real world portability of C++ programs. C++, like C, is clearly meant to be compiled into native code (even though it is possible to write C and C++ interpreters). This means that it has the flexibility to link against implementations of other standard libraries, such as OpenGL for graphics.

      Examine, if you will, the so-called portability of Java programs. I would expect that most Java programs would not run properly (or at all) on a device with a small screen (such as a PDA or a phone). In fact, most phones support a specialized form of Java called MIDP. This is no different in practice than using ANSI C with a specialized library.

      I'm not saying that it's not beneficial to have standard but optional APIs defined for every possible application under the sun. I'm just saying that's a lot of work, and there's a point past which returns are diminished.

  229. Bad Analysis, Discounts Temporal Issue by HopeOS · · Score: 1

    The parent post overlooks the fact that GC is penalized repeatedly while malloc/free incurs a one-time hit. O(N_dead) vs. O(N_live) is not the correct model.

    Each allocation must be returned to the heap whether using malloc/free or GC. That's a fact of life. Moreover, in any OOP language, (C++, C#, or Java) you may also have deconstructors or finalization to worry about. Memory deallocation should be discounted as baseline as none of these languages offers any advantage over the other in terms of speed.

    This still leaves GC with the recurring overhead of tracking live objects.

    No matter how many allocations have been previously freed, malloc/free-based languages do not have to repeatedly iterate through them, invalidating the parent poster's argument that the ratio of live/dead objects will ever tip the balance in favor of GC.


    -Hope

    1. Re:Bad Analysis, Discounts Temporal Issue by J.+Random+Software · · Score: 1
      Each allocation must be returned to the heap whether using malloc/free or GC.

      Not individually. Once a copying collector has relocated live objects into tospace, it can immediately reuse all of fromspace for new allocations. malloc/free require extra bookkeeping (besides risking dangling references) in return for making small portions of the heap reusable immediately.

      Finalization is uncommon (only applies to objects that manage non-memory resources), and all the collector has to do is walk a short list of objects in fromspace that had finalizers. You have to queue finalizers anyway, unless you can afford to interrupt your code's critical paths to run them immediately.

      But you're right, an object can be traced more than once, though a generational collector can keep the overhead quite low. Almost all collections only trace objects that are still live but haven't yet been promoted out of the first generation (there are tricks for handling old objects' occasional references to young objects), and almost all objects are either dead right away or live for a very long time. If I had to guess, I'd say overhead per object grows logarithmically with the number of first-generation collections the object lives through (which is usually zero).

  230. Re:Whatever. by Anonymous Coward · · Score: 0

    If you think OO, you do this by inheriting an interface and implementing the comparison function the way you want. You can then search by just plugging in a suitable object (implementing the comparison). Or you can use a pattern (find it yourself).

  231. Re:Whatever. by Anonymous Coward · · Score: 0

    Stupid. How do you implement overloaded methods? How do you implement abstract interfaces?

  232. If This Is A Problem... by HopeOS · · Score: 1

    You are either ignoring the obvious solutions or using the wrong programming language.

    It is generally understood that certain changes to a C++ base class will invalidate derived classes. This is not a side-effect; it's a given. Asking for this to be fixed is like asking that nails be provided with threads and a slot on top for easy removal. If you need to use a screw, use a screw.

    -Hope

  233. C$ copyright violation by GnarlyNome · · Score: 1

    Micro$ux already has copyrights on any thing that refers to $

    --
    Diplomacy is the art of saying "Nice doggie" until you can find a rock. Will Rogers
  234. Not for nothin by otherwhere · · Score: 1
    be ready to cite Chapter 13 of ANSI/ISO C++98... It would really reduce S/N.

    I think you mean increase signal to noise; if so, I agree wholeheartedly.

    I'm from Brooklyn, i'm allowed to say "not for nothin'" unironically.

  235. Header files for the uninitiated by Anonymous Coward · · Score: 0

    If you defined your functions twice, you'd receive an error from the compiler. In the header file, typically, you declare your functions.

    This has been a public service announcement by the cognoscenti for the benefit of the neophyte.

  236. dynamic_cast by Anonymous+Brave+Guy · · Score: 1
    Also, when was the last time *you* used the dynamic_cast operator, Mr. Smartypants?

    You can cast both up and down a class hierarchy. Usually, you only need to go one way, and polymorphism suffices. Sometimes, it's useful to go the other way, and the safest and most convenient method of doing that is a dynamic_cast.

    You can even combine the cast with an if statement to ensure that no code ever tries to use a pointer that's been cast to a more derived type unless the cast succeeded, i.e., the object pointed to really is of a suitably derived type:

    base *b = make_some_object();
    if (derived *d = dynamic_cast<derived*>(b))
    {
    do_something_with_derived_objects_only(d);
    }
    // Can't even accidentally use d now; it's out of scope.
    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  237. Subsets of features and when they're useful by Anonymous+Brave+Guy · · Score: 1
    Sure, there are a lot of features, but basically everybody uses the sane subset thereof, and every once in a great while, if they really, really need it, they can use some of those fancy, destruct-o-matic features.

    I think it's important to realise that most of the time, you shouldn't be using a lot of the nitty gritty features in C++: they're primitive, low level features, designed to offer maximum flexibility and performance, without any particular guarantees of safety. For most code, you should be using higher level tools with a more appropriate balance of performance, flexibility and safety.

    However, a lot of the smarter, higher level tools now becoming popular -- libraries like the Boost collection and Loki, for example -- are possible precisely because a few people, typically those writing libraries of higher level tools, have the low level features available. If you're writing your own tools, you'd miss most of the power of a language like C++ if the low level support weren't there.

    So I agree with you that many people use the same subsets of the tools available, but I think there is (or at least should be) a pretty clear distinction. Most applications programmers should rarely be using many of the language features, and will mostly use only the basics and some higher level tools, probably from libraries. The people writing those higher level libraries, on the other hand, will probably be using every trick in the book to make the library code as widely useful as possible, and for them, that extra power is invaluable, and what sets a language like C++ apart from something like Java or C#.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  238. File system based coding is a DODO by cheekyboy · · Score: 1

    The whole concept of files and headers etc is the out dated methodology.

    What we need is a ONE project based system, that has all files transparent, perhaps internally it might be 1 file per class/function, but in the IDE its all in one with no files, just objects.

    --
    Liberty freedom are no1, not dicks in suits.
    1. Re:File system based coding is a DODO by be-fan · · Score: 1

      Kinda makes it hard to use for those legions of coders who don't use an IDE :) I don't think VIM will take well to having to display object graphics. I do think we need a better module mechanism, but the resulting system must still be text-pased. If you don't like it, go use Squeak.

      --
      A deep unwavering belief is a sure sign you're missing something...
  239. Re:What C++ really needs to do by Anonymous Coward · · Score: 0

    The problem is that compile-time exception enforcement ALA Java make many C++ programmers puke.

    It always ends up in one of three ways:
    1) Throws-lists that take three rows themselves and makes the code look fugly.
    2) A lot of methods throwing Exception, which means a lot of work for nothing.
    3) throw / catch blocks all over the place doing basically nothing other than printing to stderr (again, making the code fugly).

    It's not worth it!

  240. YOU care! by devphil · · Score: 1
    C++ on the other hand can have all the extra stuff it wants and it doesn't affect my project. If I don't wan to use templates or whatever, I don't have to. And the compiler won't force me to include anything.

    You're absolutely right. One of C++'s critical strengths is the zero-overhead principle.

    The part you're overlooking is this: consider a language with two features. Then, for any given user program, there are four possibilities that the compiler (and thus, the compiler vendors, and thus, the language standard) has to be prepared to handle: the user uses none of them, or A, or B, or both A and B.

    It's the last one that gets interesting. Feature A (say. run-time binding) has nothing directly to do with Feature B (say, "pointer to array is same as pointer to single thing", which we got from a different language). But their interaction can be surprising (say, deleting an array of Derived through a pointer-to-Base, which usually causes segfaults if sizeof Derived > sizeof Base).

    Now consider a language with three features. Eight possibilities (none, A, B, C, AB, BC, AC, ABC).

    Now consider C++. It's not forcing anybody to use features #3, #12, and #57, but if you use them in combination, the result had better be mentioned in the standard. And it had better make sense.

    That's why the committee (and the compiler writers) are worried about adding new features to C++. Or any other language. It's not the features themselves that cause problems, it's the surprising ways in which they all interact. As a user of the language, it would behoove you to also be worried, because you could be relying on feature #22 without realizing it, and brand-new feature #107 just shot #22 in the ass.

    --
    You cannot apply a technological solution to a sociological problem. (Edwards' Law)
  241. C++ template code bloat: fact or fantasy? by Anonymous+Brave+Guy · · Score: 1
    Bracha pointed out that one problem with C++ templates is code bloat.

    This is a tiresome and usually ill-founded argument. How much (space) overhead do you really think is incurred in a typical application as a result of this design decision?

    Consider the common template example of a container class. Generalising but not much, you don't use a container class with many different types in most programs, and you don't use many of the methods available on it even then. Since only the implementation of necessary function specialisations is generated, the overhead is usually very little.

    Moreover, techniques exist to reduce this overhead in some cases where it's of particular interest. For instance, a list<T*> can typically be just a typesafe wrapper for a list<void*>. These techniques are in active use, by the better STL implementations, for example.

    While we're on the subject of space overhead, I'll just note that in the dynamic-binding languages, you typically have to instantiate a generalised version of every member function, since you never know who will be using your function and with what generic parameters. This can easily result in more space overhead in realistic circumstances than the specific code generated by C++ templates.

    Now, consider the advantages of compiling specialisations rather than a single generic implementation. Your scope for optimisation is much better in this case, and a generic implementation of a function typically carries no more overhead than a specific one. A common example here is comparing C++'s std::sort with C's qsort, where the former frequently produces much superior output code due to the improved scope for optimisation.

    Moreover, you have scope to optimise out whole layers of template mechanics. This allows high performance maths and expression template libraries to use clever template mechanics behind the scenes with impunity, while offering fairly straightforward syntax to the "end user".

    As far as I can tell, all of this comes down very much in favour of C++'s approach. Java, as usual, adopts an approach where everything is available dynamically at run time, which grants a lot of flexibility on one hand, but carries a heavy performance penalty on the other (some, but crucially not all, of which can be overcome with JIT techniques).

    There is nothing inherently superior about either approach: they are different design decisions with different goals in mind, each better for its own goal. Claiming that C++ templates induce more code bloat than Java's generics is, under realistic circumstances, pretty much wrong, though.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  242. Re:Whatever. by Anonymous Coward · · Score: 0

    Inheritance bloats. Have you ever seen how much unneccessary junk goes into a Java JButton? All that extra garbage still has to be churned through, and will slow your implimentation way down.

  243. Re:Whatever. by Anonymous Coward · · Score: 0

    What's stupid is insisting on loading the language down with cruft just so you can concatenate strings with a "+". You're adding unneccessary complexity just so you can have a function call resemble something that it's not.

    Abstract, nothing. If you need it, put it in. If you don't, keep it and the crufty framework the fuck out.

  244. Re:Whatever. by Anonymous Coward · · Score: 0

    Preach on, brother!
    Fucking pussies use ramping cpu speeds to justify being stupid. "Oh, it's too hard! Why can't it be aligned according to my Feng Shui? Waahh!"

  245. Re:Still need 7 lines for an encapsulated attribut by Anonymous Coward · · Score: 0


    Um... And how is that different than just making x public?

    The difference is in how you access the attribute. When it is public you would do something like:

    SomeClass Y;
    Y.x = 3;

    With an encapsulated attribute you would do:

    SomeClass Y;
    Y.setX(3);

    This may not seem like an important difference, and indeed it is not until you want to change how x are written or read. For example if you want to change setX to:

    void setX(int x) {
    if (x < 0)
    return;
    else
    this->x = x;
    }

    Now if you have just used a public variable, you will have to change all the places where the x-attribute is accessed. When it is encapsulated you can just make the changes within the class where the x-attribute is declared.


    ReadOnly<int> x;

    (definition of ReadOnly left as an exercise for the student).

    You can not use templates to declare methods within the class they are used. That is you can not make the ReadOnly template, such that:

    class Y {
    ReadOnly<int> x;
    }

    Will translate into (at an intermediate compiler stage):

    class Y {
    int x;
    int getX() { return x; }
    }

  246. Re:Still need 7 lines for an encapsulated attribut by J.+Random+Software · · Score: 1

    You don't need setX/getX in the owning object, just change x from an int to a class that implements operator = and operator int. If modifying x requires access to the owning object, it's not behaving like an attribute, so making its interface resemble one is misleading.

  247. The result of a ++ operator is not an lvalue by Diomidis+Spinellis · · Score: 1
    The result of applying the ++ operator on a variable is a plain value, not an lvalue (an entity that can appear on the left side of an assignment). The ++ operator has to be applied to an lvalue. Thus C++++, ++C++, and so on are not legal constructs. Convince yourself:
    $ cat t.c
    foo() { int C; C++++;}
    $ cc t.c
    t.c: In function `foo':
    t.c:1: invalid lvalue in increment

    Diomidis Spinellis - Code Reading: The Open Source Perspective
    #include "/dev/tty"

  248. Re:Still need 7 lines for an encapsulated attribut by Anonymous Coward · · Score: 0

    Get/set methods are concerning the use of a class. How it is actually implemented is another matter. The use and implementation can be very different. This makes it possible to make changes to the representation of your data, without having to change code thoughout your program. Below is an example to illustrate the point:

    class Person {
    string name;
    public:
    string getName() { return name; } ...
    }

    One year later your discover that it was a bad way to organize your data. Using first name and surname would have been better. With get/set methods you can change your class to:

    class Person {
    string firstName;
    string surName;
    public:
    string getName() { return firstName + " " + surName; } ...
    }

    The users of the class will not have to change one line of code. You cannot do this with operator int and operator =.

  249. Frikking fix C++... by exp(pi*sqrt(163)) · · Score: 1
    Well, that would be a better solution. I can only assume that this is hard.

    But please, Lisp is no use to me. I have to work in the real word with pre-existing C++ software libraries and an expectation of high performance.

    --
    Doesn't it make you feel good to know that our freedoms are protected by politicans, lawyers and journalists.
  250. Coffe? by Anonymous Coward · · Score: 0

    Java name is not too bad, let's try 'Jacobs'...

  251. ++C++ by hayriye · · Score: 1

    We incremented it in the past, we're incrementing it now

  252. Re:Still need 7 lines for an encapsulated attribut by J.+Random+Software · · Score: 1

    This works unless changing a person's name has side effects on other
    members (or vice versa), but in that case the name doesn't behave like
    an attribute so it shouldn't be usable as one. It's more lines than
    yours but is reusable and behaves much more like a builtin type.
    (You may have to move >> and << outside the class if your compiler's
    Koenig lookup is broken.)

    #include <sstream>

    struct person_name {
    std::string first, last;
    person_name() { }
    person_name(std::string const &first, std::string const &last): first(first), last(last) { }
    person_name(std::string const &name) { *this = name; }
    person_name const &operator =(std::string const &name) {
    std::istringstream(name) >> *this;
    return *this;
    }
    operator std::string() const {
    return static_cast<std::ostringstream &>(std::ostringstream() << *this).str();
    }
    static std::ostream &operator <<(std::ostream &os, person_name const &name) {
    return os << name.first << ' ' << name.last;
    }
    static std::istream &operator >>(std::istream &is, person_name &name) {
    return is >> name.first >> name.last;
    }
    };

    class person {
    public:
    person_name name;
    };