Slashdot Mirror


C++14 Is Set In Stone

jones_supa (887896) writes "Apart from minor editorial tweaks, the ISO C++14 standard can be considered completed. Implementations are already shipping by major suppliers. C++14 is mostly an incremental update over C++11 with some new features like function return type deduction, variable templates, binary literals, generic lambdas, and so on. The official C++14 specification release will arrive later in the year, but for now Wikipedia serves as a good overview of the feature set."

193 comments

  1. Stone by buchner.johannes · · Score: 4, Funny

    Wouldn't it more useful for it to be set in silicone?

    --
    NB: The message above might reflect my opinion right now, but not necessarily tomorrow or next year.
    1. Re:Stone by makq · · Score: 3, Informative

      Silistone!

    2. Re:Stone by marxidad · · Score: 2

      *silicon

    3. Re:Stone by Carewolf · · Score: 1

      Wouldn't it more useful for it to be set in silicone?

      Assuming you mean silicon, then; no - Setting things in stone is better than writing them in the sand.

    4. Re:Stone by NotInHere · · Score: 4, Informative

      Actually, its set in {La,}Tex: https://github.com/cplusplus/d...

    5. Re:Stone by geekoid · · Score: 1, Informative

      silicon isn't sand. It's found in sand and stone, among other places.

      --
      The Kruger Dunning explains most post on /. http://en.wikipedia.org/wiki/Dunning%E2%80%93Kruger_effect
    6. Re:Stone by Anonymous Coward · · Score: 0

      Lithography is still the name of the process.

    7. Re:Stone by Anonymous Coward · · Score: 0, Flamebait

      In your vagina as well.

    8. Re: Stone by Anonymous Coward · · Score: 1

      Silicon maybe.
      Silicone is a little rubbury.

    9. Re:Stone by Anonymous Coward · · Score: 0

      Wouldn't it more useful for it to be set in silicone?

      Silicone is what they use for breast implants. Silicon is what chips are made of. That said, I'm not sure I wouldn't prefer the former... :-)

    10. Re:Stone by cluening · · Score: 1

      Sounds a bit wobbly. Maybe silicon instead?

      --
      Posted from the wireless couch.
    11. Re:Stone by relisher · · Score: 1

      As opposed to soggy construction paper

    12. Re:Stone by Anonymous Coward · · Score: 0

      Wouldn't it more useful for it to be set in silicone?

      No, silicone is for making fake boobs.

      But, that could be more fun to work with, I suppose.

    13. Re:Stone by Carewolf · · Score: 1

      Really Carewolf? Really?

      That was not me. I don't troll.

  2. Still... by fyngyrz · · Score: 3, Interesting

    ...using c. Although I do like to comment thusly, and so prefer a compiler that understands at least basic c++:

    // comment

    I like to stay as close to the metal as I can get. I'd use assembler, but many of my projects are cross platform, so c it is.

    --
    I've fallen off your lawn, and I can't get up.
    1. Re:Still... by makq · · Score: 5, Funny

      Various black hats appreciate your dedication to C.

    2. Re:Still... by The+Evil+Atheist · · Score: 0

      Have you ever written C code which uses a switch statement based on what type a struct/union is and calling the relevant code for it? Have you ever used qsort?

      --
      Those who do not learn from commit history are doomed to regress it.
    3. Re:Still... by Anonymous Coward · · Score: 1, Informative

      Those are proper C comments since C99, no need for C++

    4. Re:Still... by tlhIngan · · Score: 4, Informative

      ...using c. Although I do like to comment thusly, and so prefer a compiler that understands at least basic c++: // comment

      I like to stay as close to the metal as I can get. I'd use assembler, but many of my projects are cross platform, so c it is.

      End of Line terminated comments ("//") actually are in the C spec as part of C99. And while it did take GCC a little while for that to be accepted in C mode, most other commercial compilers accepted them just fine. (C++ is not completely compatible with C, mind you, unlike Obj-C which is fully C compatible. This can cause issues if you try to compile C code using a C++ compiler rather than a C/C++ compiler)

      Now, one interesting thing in C++14 is binary literals (using "0b" a la "0x" for hex). That seems handy, though it would be more appropriate to be in C than C++ as C generally needs that sort of specification. Though, annoyingly, they didn't seem to allow use of something like _ to break long literals up into human-readable groups. I mean, a 32-bit string of bits is already hard enough to visually see, allowing the use of something like "_" in the string to help arbitrarily break up and group long constants would be helpful. (Even in hex it would be useful when doing 64-bit values).

      E.g., would you rather try to see which bit is set in a string like "0b001011010011011101011100" or have it broken up like "0b0010_1101_0011_0111_0101_1100" or "0b00101101_00110111_01011100". If it's a bit field, you may even want "0b001011_010011011_01_0_111_0_0" if breaking it into fields has meaning.

      Such a small change to help readability...

    5. Re:Still... by jones_supa · · Score: 2

      Interestingly, Visual Studio got C99 library support last year. I'm mentioning this because the C support in VS has mostly been a desert scene with tumbleweeds passing by. I'm not sure how close VS is to full C99 support and what pieces are possibly missing. Does anyone know?

    6. Re:Still... by adonoman · · Score: 2

      I don't know if it was officially accepted, but I believe they added ' as a digit-group separator: 0b0010'1101'0011'0111'0101'1100

    7. Re:Still... by Anonymous Coward · · Score: 5, Informative

      Though, annoyingly, they didn't seem to allow use of something like _ to break long literals up into human-readable groups.

      Yes they did. It's not underscore, it's apostrophe. For example:
              auto a = 0b100'0001; // ASCII 'A'
              auto million = 1'000'000;

      See here:
              http://isocpp.org/wiki/faq/cpp14-language#digit-separators>http://isocpp.org/wiki/faq/cpp14-language#digit-separators

    8. Re:Still... by Imagix · · Score: 5, Informative

      Uh, yes they do. Don't rely on summaries to list all of the features of the language. From N3797: An integer literal is a sequence of digits that has no period or exponent part, with optional separating single quotes that are ignored when determining its value. Example: The number twelve can be written 12, 014, 0XC, or 0b1100. The literals 1048576, 1’048’576, 0X100000, 0x10’0000, and 0’004’000’000 all have the same value. — end example

    9. Re:Still... by dmbasso · · Score: 1

      E.g., would you rather try to see which bit is set in a string like "0b001011010011011101011100" or have it broken up like "0b0010_1101_0011_0111_0101_1100" or "0b00101101_00110111_01011100". If it's a bit field, you may even want "0b001011_010011011_01_0_111_0_0" if breaking it into fields has meaning.

      Such a small change to help readability...

      If you're really interested in readability you would probably define those bits, like:

      #define HIGHSTUFF (0b001011 << 17)
      #define NOTSOHIGHSTUFF (0b010011011 << 8)

      and then or them together.

      Alternatively you could define a macro for your bit field, like:

      #include
      #define bitfield(a,b,c,d) 0x##a##b##c##d
      int main() {
              printf("%x", bitfield(f,f,f,f));
      }

      --
      `echo $[0x853204FA81]|tr 0-9 ionbsdeaml`@gmail.com
    10. Re:Still... by fyngyrz · · Score: 1

      Ha. Funny. Thank you, didn't know that.

      --
      I've fallen off your lawn, and I can't get up.
    11. Re:Still... by Anonymous Coward · · Score: 0

      ... Though, annoyingly, they didn't seem to allow use of something like _ to break long literals up into human-readable groups. I mean, a 32-bit string of bits is already hard enough to visually see, allowing the use of something like "_" in the string to help arbitrarily break up and group long constants would be helpful. (Even in hex it would be useful when doing 64-bit values).

      E.g., would you rather try to see which bit is set in a string like "0b001011010011011101011100" or have it broken up like "0b0010_1101_0011_0111_0101_1100" or "0b00101101_00110111_01011100". If it's a bit field, you may even want "0b001011_010011011_01_0_111_0_0" if breaking it into fields has meaning.

      Such a small change to help readability...

      You can already use whitespace to separate strings in string constants:

      "This" "Is" "Already" "One" "String"

      Not sure if that applies to non-string "string" constants, though.

    12. Re:Still... by Anonymous Coward · · Score: 0

      Black hats love idiots who think using other languages (written in C) are somehow now immune from buffer overflows.

      Go write some Python/Java/C# and I'll show you some overflows in their JVM that make a basic "Hello world" program crash. The main difference is that in C I choose to allow such bugs or behavior. In the other languages the bugs are *already* there in the JVM and there's nothing you can do about it. Your hello world program is susceptible.

    13. Re:Still... by fyngyrz · · Score: 4, Interesting

      Have you ever written C code which uses a switch statement based on what type a struct/union is and calling the relevant code for it?

      No. When I use structures as objects (which is often), they almost always contain a pointer to a block of general methods appropriate to that structure, as well as containing any methods unique to the object, all of which are called through the object/structure, so it would be unusual, at least, to be testing the object type in order to choose an object-specific procedure to call. However, I do mark each object type with a specific ID and serial as they are created, along with a tag indicating what procedure created them, as these things facilitate some very useful memory management and diagnostic mechanisms.

      Have you ever used qsort?

      I am aware of qsort. But I have my own multi-method sort library that I use. Most of them locate the comparison mechanisms they are to use through the procedures specified by the objects they are asked to sort. Likewise list management, memory management, certain types of drawing primitives and image processing primitives, image handling mechanisms, associative storage, basically anything I have run into that I thought likely I would need more than once. I am positively locked into the idea that if I write it, I can fix it, and the number of bugs and problems that fall into the "maybe they'll fix the library someday" class are greatly reduced. I'm a little less picky if I have the source code to a capability I didn't actually write and can supply my own version if and as needed. A good example of something like that is SQLite. Actually having the source code and compiling it in reduces my inherent paranoia to a somewhat duller roar.

      --
      I've fallen off your lawn, and I can't get up.
    14. Re:Still... by UnknownSoldier · · Score: 1

      > Now, one interesting thing in C++14 is binary literals (using "0b" a la "0x" for hex).

      Hey, it only took ~40 years for a C based language to add binary literals! (It will only take another 40 to standardize pragmas such as struct packing.)

      Using 0b is dumb. They should of used a letter that isn't in hex, say 0z1101.

      Using '_' would of been nice but the C++ community doesn't really have a fucking clue about solving real-world problems. Witness ...

      Herb Sutter looking into adding Cario 2D into C++
      "http://developers.slashdot.org/story/14/01/04/2115249/cairo-2d-graphics-may-become-part-of-iso-c"

      This is your typical design-by-committee of a "Solution looking for a Problem"

      --
      "One of my most painful programming memories was working on a professional C++ compiler. My colleagues used to joke:
      There are 2 problems with C++: It's design, and implementation. "

    15. Re:Still... by slashdice · · Score: 1

      VC++ is a C++ compiler. They generally only add C features when they're incorporated into C++ (which will be never for some of them).

      --
      Copyright (c) 1990 - 2014 Dice. All rights reserved. Use of this comment is subject to certain Terms and Conditions.
    16. Re:Still... by Anonymous Coward · · Score: 0

      Black hats love idiots who think using other languages (written in C) are somehow now immune from buffer overflows.

      The difference is that the C code only has to be written right once, then all programs will be correct.

    17. Re:Still... by Anonymous Coward · · Score: 0

      Herb Sutter looking into adding Cario 2D into C++
      "http://developers.slashdot.org/story/14/01/04/2115249/cairo-2d-graphics-may-become-part-of-iso-c"

      This is your typical design-by-committee of a "Solution looking for a Problem"

      Yikes! So basically what he's saying is that from that point on libstdc++.so will _require_ libcairo.so in order to print hello world?

    18. Re:Still... by Anonymous Coward · · Score: 0

      Have you ever written C code which uses a switch statement based on what type a struct/union is and calling the relevant code for it? Have you ever used qsort?

      Isn't that why people use GLib/GObject? To use a well-tested, object oriented, multi-language, cross-platform abstraction layer on top of C.

    19. Re:Still... by UnknownSoldier · · Score: 1

      Unknown. Pure madness lies that way so maybe the committee has come to its senses ...

      One can always hope/pray/etc...

    20. Re:Still... by gnupun · · Score: 1

      Java has good out-of-bounds checking for arrays, unlike the non-existent support in C. Could you explain how exactly a buffer overflow can happen in Java (calling native code is not allowed)?

    21. Re:Still... by doti · · Score: 1

      And also the bool type, and the ability to declare variables after the beginning of a function.

      --
      factor 966971: 966971
    22. Re:Still... by K.+S.+Kyosuke · · Score: 1

      Are you sure there isn't a better way, even in C?

      --
      Ezekiel 23:20
    23. Re:Still... by jones_supa · · Score: 1

      All right, so basically we're hanging on what kind of C-like features a subset of C++ happens to provide.

    24. Re:Still... by angel'o'sphere · · Score: 1

      Year, it is really annoying that 'computers' don't really contain metal any,ore now as all important parts are made from semi conductors, I feel your pain :-/

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    25. Re:Still... by angel'o'sphere · · Score: 1

      A basic 'Hello World' program can not crash, and everything that has no input can't be made crash from the outside to a buffer overflow. 'Hello World' programs fall into that category.

      I doubt you know all bugs of all JVMs that could a particular program of me make crash, if you only have acces to it from the outside, and would even go so far, you can not do it if you have console access.

      And for that matter: it is hard enough to crash/abuse a C program if you can not debug/analize it.

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    26. Re:Still... by TheRaven64 · · Score: 1

      If you can't call native code, you probably don't have a working JVM. The Oracle JDK and OpenJDK each include around a million lines of C in their standard libraries. That doesn't mean that you won't find it easier to write secure code in Java, it just means that you probably don't have much less C code in your TCB for a Java program than you do for a C one.

      --
      I am TheRaven on Soylent News
    27. Re:Still... by Anonymous Coward · · Score: 0

      Yea because we would never confuse 'a' with 1'000'000.00

    28. Re:Still... by Carewolf · · Score: 2

      ...using c. Although I do like to comment thusly, and so prefer a compiler that understands at least basic c++: // comment

      I like to stay as close to the metal as I can get. I'd use assembler, but many of my projects are cross platform, so c it is.

      End of Line terminated comments ("//") actually are in the C spec as part of C99. And while it did take GCC a little while for that to be accepted in C mode...

      What on Earth are you talking about?? Using C++ comments in C was a GCC extension that made it into C99.

    29. Re:Still... by cytg.net · · Score: 1

      " JVM that make a basic "Hello world" program crash." with a reference to a .c ? Yes please show me that "hello world" .. oh cherrypicking a jvm from 2001 doesnt count.

    30. Re:Still... by tepples · · Score: 1

      Only if you choose to make hello world with Cairo. There are still two other standard options: hello world with cstdio, and hello world with iostream. But I imagine that trying to statically link Cairo, as one would have to do on an embedded system, will produce an executable even larger than then 180K Thumb executable that GNU libstdc++ gave me when I tried to do hello world in iostream.

    31. Re:Still... by UnknownSoldier · · Score: 1

      If you haven't seen this, you'll probably appreciate / enjoy this:

      Smallest "Hello World" ELF: 142 bytes

      Programs are so bloated today.

    32. Re:Still... by romiz · · Score: 1

      Why did they go for this ? Ada introduced the underscore years ago, Java followed in Java 7 recently, and for example Rust uses the underscore as well. And it also allows multiple separators, which allows for aligning the columns in bitmasks for example, while it's forbidden in C++. See the Java specification for example.

    33. Re:Still... by Anonymous Coward · · Score: 0

      Please show an overflow in a basic hello world in C#, Python, Java and Ruby.

      You can also show for some other languages but I'm honestly interested in those.

    34. Re:Still... by flargleblarg · · Score: 1

      Using 0b is dumb. They should of used a letter that isn't in hex, say 0z1101.

      There's nothing dumb about it at all. First of all, the prefix 0b cannot be confused with a hex digit because you need the prefix 0x to get hex.

      Secondly, if you're concerned about b looking like a hex digit, well, there's your problem. Lowercase hex digits are the devil's work. Always write hex digits using uppercase letters, as $DEITY intended.

      Finally, what the hell is the z supposed to stand for in 0z?

    35. Re:Still... by Anonymous Coward · · Score: 0

      Underscore leads to ambiguities - it does not play well with user literals such as 0x0123_a.

    36. Re:Still... by brantondaveperson · · Score: 4, Funny

      From the "re-inventing C++" department... :)

    37. Re:Still... by WWJohnBrowningDo · · Score: 1, Funny

      Finally, what the hell is the z supposed to stand for in 0z?

      He's probably a German speaker. Binary is Zeugenschutzprogramm in German.

    38. Re:Still... by shutdown+-p+now · · Score: 1

      VC++2013 added a bunch more stuff from C99, aside from the library. On the language side, it's mixing declarations with code (C89 mode was strict and would bark at any variable not at the beginning of the function), _Bool, compound literals, and designated initializers.

      The main things still missing are "restrict", _Complex and VLAs. However, the official target is now C11 rather than C99, and C11 made VLAs an optional feature of the language, because of lackluster support and use.

    39. Re:Still... by shutdown+-p+now · · Score: 1

      This is not entirely true - they have added a bunch of C11 features in VS 2013.

    40. Re:Still... by K.+S.+Kyosuke · · Score: 2

      Not necessarily. C++ has a fixed semantics for its method dispatch, one that is fairly bizarre in any case.

      --
      Ezekiel 23:20
    41. Re:Still... by K.+S.+Kyosuke · · Score: 1

      As I mentioned below, you might be interested in this (at least cherry-pick-some-ideas-wise).

      --
      Ezekiel 23:20
    42. Re:Still... by Daltorak · · Score: 1

      Interestingly, Visual Studio got C99 library support [msdn.com] last year. I'm mentioning this because the C support in VS has mostly been a desert scene with tumbleweeds passing by. I'm not sure how close VS is to full C99 support and what pieces are possibly missing. Does anyone know?

      Microsoft's VC++ team blog provides details on conformance to C99, C++11 and C++14 on a regular basis. Here's a recent one:

      http://blogs.msdn.com/b/vcblog...

      The TL;DR: their C99 support is complete except for tgmath.h (though they do have ctgmath from C++11). VS2013's printf is also missing some format specifiers though that has been resolved for VS "14". Apparently they had to rewrite their 1980s-era implementation of printf from scratch to get this finished...... not exactly a trivial job. A couple of other minor things are missing too.

    43. Re:Still... by Anonymous Coward · · Score: 0

      Your post is so full of facepalm I'm skeptical you could even find the download link for either of those three technologies, much less figure out how to exploit them.

      Whether it's the fact that you think Python/C# have a "JVM" (hint: JVM stands for Java Virtual Machine), or the fact that you don't understand that an application with no input can't suffer a buffer overflow or the fact that you're conflating an underlying platform, with an application that runs on it I'm completely at a loss to understand why you would even post such drivel whilst simultaneously demonstrating a complete lack of understanding on the topic.

      I mean, where do people like you come from? It's like if I go to a thread on some site on the internet and that specialises in advanced nuclear physics and rolled off some drivel about how they're wrong - I'd have no idea what I was on about there, just as you don't here, so it'd be obvious to those who were informed that I was just spouting drivel and being an idiot, it wouldn't be worth my time, so why is spouting drivel and being an idiot worth your time exactly?

    44. Re:Still... by fyngyrz · · Score: 1

      Thanks, looks like very interesting reading. Bookmarked it.

      --
      I've fallen off your lawn, and I can't get up.
    45. Re:Still... by fyngyrz · · Score: 1

      I think he was just pinging me for the ideas, which do predate my efforts and is certainly fair -- I started my whole "object" approach to c in 1985.

      Of course, the whole point was to avoid using compiler tech that generated code I didn't intend it to generate, and in that sense, I got what I was after.

      I wish I could still write my code in assembler, though. I was never more at home than when churning out 6809 or 68000 code.

      --
      I've fallen off your lawn, and I can't get up.
    46. Re:Still... by UnknownSoldier · · Score: 1

      The 'x' in 0x stands for hexidecimal

      I picked 'z' because:

      a) it is not a hex digit
      b) it close to x to type
      c) it is a mnemonic for zero
      d) it stands just enough out
      e) it has an hint of symmetry about it -- z is the last character in the alphabet so using it for the lowest number base seems appropriate.

      Considering some assemblers have used the dumb '%' percent sign to designate binary, having a consistent form with C's hex literal leaves a little choices:

      Using a .. f is retarded because they are hex digits. 'x' is taken. Using I, L, O is dumb because lowercase they blend in.

      That leaves: g, h, j, k, m, n, p, q, r, s, t, u, v, w, y , z

      0g110101 looks dumb
      0h110101 looks dumb, some languages use 'h' for hex
      0j110101
      0k110101
      0m110101 blends in
      0n110101 blends in
      0p110101
      0q110101
      0r110101 blends in
      0s110101
      0t110101 blends in
      0u110101 used for unsigned -- not appropiate
      0v110101 maybe
      0w110101 too verbose
      0y110101 maybe
      0z110101

      So which symbol would you pick??

    47. Re:Still... by flargleblarg · · Score: 1

      So which symbol would you pick??

      Well I would pick b, because it isn't a hexadecimal digit.

      { 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F } are hexadecimal digits.

    48. Re:Still... by Anonymous Coward · · Score: 0

      I thought this was about Carbon 14. Now where is the apt for finding Optometrists?

    49. Re:Still... by Anonymous Coward · · Score: 0

      They should of used a letter

      "should have used".

      Using '_' would of been nice

      "would have been nice".

      "http://developers.slashdot.org/story/14/01/04/2115249/cairo-2d-graphics-may-become-part-of-iso-c"

      "<URL:http://developers.slashdot.org/story/14/01/04/2115249/cairo-2d-graphics-may-become-part-of-iso-c>", which produces an actual link on which you can click: http://developers.slashdot.org/story/14/01/04/2115249/cairo-2d-graphics-may-become-part-of-iso-c

      There are 2 problems with C++: It's design, and implementation.

      "Its".

  3. Support for your position by fyngyrz · · Score: 4, Funny

    Wouldn't it more useful for it to be set in silicone?

    Intend to stay abreast of the spec, do you?

    --
    I've fallen off your lawn, and I can't get up.
    1. Re:Support for your position by Anonymous Coward · · Score: 5, Funny

      You boob. Take your puns and go.

    2. Re:Support for your position by Anonymous Coward · · Score: 2, Funny

      Okay. Ta-ta!

    3. Re:Support for your position by geekoid · · Score: 3, Funny

      Did they make any changes in mammary allocation?

      --
      The Kruger Dunning explains most post on /. http://en.wikipedia.org/wiki/Dunning%E2%80%93Kruger_effect
    4. Re:Support for your position by jones_supa · · Score: 3, Funny

      Goodbye. Now I'm just gonna relax and listen the tits chirping.

    5. Re:Support for your position by Anonymous Coward · · Score: 1, Funny

      Well, support for the c++ standard did seem to be sagging for a while. I'm glad it is finally getting some more support. Maybe we will seem some more perky behavior from it.

    6. Re:Support for your position by iluvcapra · · Score: 2

      Yes, but it corrupted the malloc areola.

      --
      Don't blame me, I voted for Baltar.
    7. Re:Support for your position by Anonymous Coward · · Score: 0

      I know when I'm breasted.

  4. Oh god so what? by Anonymous Coward · · Score: 0, Flamebait

    C++ used to be a lightweight set of templates for C. It was good. It was versatile. It was useful. It was easy to learn and easy to develop with it.

    Now it's one of a million things in the computing world suffering so much feature creep, designed by people who have been tinkering with the platform for the past 30 years - that being the only reason they have had enough time to properly learn all its features.

    One day we'll return to a time when computing tools are written for the user rather than for the glory (or the profit) of the tool-builder. We'll understand once again where apparent monstrosities like Visual Basic and COBOL came from: a desire to enable the non-expert to quickly find, understand and implement the features he/she needs for a specific set of use cases. We will return to a time when development and administration was a skill not outsourced to one of a dozen big companies across the planet.

    1. Re:Oh god so what? by Arkh89 · · Score: 1

      I see a lot of people complaining about the complexity of the language. But it seems that no one dares to give any example. For my part (I had a 3-days introduction to C++, everything else was learnt by practicing) I don't find it really enormous. Aside from the auto (because type deduction = E.V.I.L., use typedef's if you don't want to spend your time typing std::someType::some_const_iterator), I fail to see what change is mandatory in the language structure. What you wrote few years ago is still correct and you don't have to use these new features to work...
      So what is it?

    2. Re:Oh god so what? by Rockoon · · Score: 1

      use typedef's if you don't want to spend your time typing std::someType::some_const_iterator)

      ..because what is needed is another level of indirection combined with increased namespace clutter...

      Why not just #define ...

      --
      "His name was James Damore."
    3. Re:Oh god so what? by geekoid · · Score: 4, Insightful

      COBOL is an excellent language for hat it was designed for. I can only assume your hate comes from ignorance.

      It seems to me, your hate would be better directed at poor engineering and software engineering standards then the tools.

      --
      The Kruger Dunning explains most post on /. http://en.wikipedia.org/wiki/Dunning%E2%80%93Kruger_effect
    4. Re:Oh god so what? by jones_supa · · Score: 2

      With one thing you are spot on: C++ has a massive feature set. Even Bjarne says that he has trouble mastering the full feature set at any given moment.

      But here's the catch: you're not supposed to know it all. C++ is like a large store where you go and "shop" just the features you need. You can keep it super simple and write C-style code and just use classes as the only C++ feature, if you want to.

      Then again, modern C++ allows you to also write many things much more elegantly and safely than before.

    5. Re:Oh god so what? by Anonymous Coward · · Score: 0

      Because #define isn't known to the compiler and doesn't obey scoping rules, bucknut.

    6. Re:Oh god so what? by Anonymous Coward · · Score: 4, Insightful

      Any individual can choose a usable subset of a complex system. The problem is that each individual chooses a different subset.

      So in the real world, you have to understand nearly all of it in order to be able to maintain other people's code or to work as a team.

      I've been writing C++ since around 1990, when the idea of an STL was being bounced desperately around by Musser and Stepanov. Back then, C++ was a genuinely simple enough language to implement in - nobody pretended that it was anything more than a C compiler preprocessor, which is mostly what it still is, with a little bit of runtime support, but there's just so much of it.

    7. Re:Oh god so what? by Lazere · · Score: 1

      Read it again. There was no hate for COBOL there, just a recognition of the hate others express.

    8. Re:Oh god so what? by Anonymous Coward · · Score: 1

      Most of the people who complain about C++ are busy maintaining legacy C++ codebases, typically written before even C++98, making all of the worst possible decisions, ignoring best practices, etc. C is harder to make visibly screwed up, which is why people think it's better, even though it's really just that C makes it easier to write subtly broken code. For example, every obvious way to deal with integer overflow will break on particular sets of compiler optimizations, because C sticks it's fingers in it's ear and says "LALALALALA INTEGERS DON'T OVERFLOW LALALALALA I'M ELIDING YOUR SECURITY-CRITICAL OVERFLOW CHECKS LALALALALA".

    9. Re:Oh god so what? by geekoid · · Score: 1

      C++ is C with classes. Templates didn't even come around until about after 1990.

      Sheesh.

      --
      The Kruger Dunning explains most post on /. http://en.wikipedia.org/wiki/Dunning%E2%80%93Kruger_effect
    10. Re:Oh god so what? by Anonymous Coward · · Score: 0

      COBOL is an excellent language for hat it was designed for. I can only assume your hate comes from ignorance.

      It seems to me, your hate would be better directed at poor engineering and software engineering standards then the tools.

      No. Its not.

      I've coded in COBOL. If you want to know what's wrong with COBOL, learn PL/I.

    11. Re:Oh god so what? by fnj · · Score: 1

      Most of the people who complain about C++ are busy maintaining legacy C++ codebases, typically written before even C++98, making all of the worst possible decisions, ignoring best practices, etc. C is harder to make visibly screwed up, which is why people think it's better, even though it's really just that C makes it easier to write subtly broken code. For example, every obvious way to deal with integer overflow will break on particular sets of compiler optimizations, because C sticks it's fingers in it's ear and says "LALALALALA INTEGERS DON'T OVERFLOW LALALALALA I'M ELIDING YOUR SECURITY-CRITICAL OVERFLOW CHECKS LALALALALA".

      You do understand that integer overflow is not buffer overflow, right? Integer overflow has absolutely nothing to do with security.

    12. Re:Oh god so what? by chuckugly · · Score: 1

      How would you assign a lambda to a variable without auto?

    13. Re:Oh god so what? by ShanghaiBill · · Score: 5, Interesting

      But here's the catch: you're not supposed to know it all. C++ is like a large store where you go and "shop" just the features you need. You can keep it super simple and write C-style code and just use classes as the only C++ feature, if you want to.

      That is fine if you are a team of one, and you never read code written by others.

    14. Re:Oh god so what? by fnj · · Score: 4, Insightful

      Err, the implication is that you can also write C++ that is not guaranteed to be maintainable by anybody short of a complete master, which even Bjarne says he is not. I think it is fair to estimate that the number of complete C++ masters in the world is in the single to double digits; no more. It may be you can identify another programming language for which that holds true. I don't think I can.

      Other successful computer languages do not have that problem. Any competent C programmer can maintain any C code, and the same for python and Java. Perl is arguable; the problem is not complexity but opaqueness.

    15. Re:Oh god so what? by Anonymous Coward · · Score: 0

      I worked with COBOL-85 for a year, and honestly there is nothing to be ignorant about because the language has nothing.

      IT HAS NO FUNCTION - I mean it, literally, and you can forget the rest of things such as data abstraction and closures. It's worse than writing assembly.

    16. Re:Oh god so what? by TechyImmigrant · · Score: 3, Insightful

      > Integer overflow has absolutely nothing to do with security.

      Yes it does. I take it you don't write much crypto code?

      --
      I should use this sig to advertise my book ISBN-13 : 978-1501515132.
    17. Re:Oh god so what? by jones_supa · · Score: 2

      Doom 3 was written like that.

    18. Re:Oh god so what? by jones_supa · · Score: 1

      Yeah, that's a good point.

    19. Re:Oh god so what? by TheRaven64 · · Score: 4, Informative

      Integer overflow has absolutely nothing to do with security

      Integer overflow has been in the top five causes of CVEs for several years running. Buffer overflows, sadly, are still at the top.

      --
      I am TheRaven on Soylent News
    20. Re:Oh god so what? by serviscope_minor · · Score: 1

      The problem (as if there's only one!) is that the c++ committee members only have one thing in common: They hate C!

      No, they all like C++, that's the one thing in common.

      So you get a mix of people trying to bolt their favorite features from cobol, haskell, java, etc onto C. You know, to improve it.

      You're an idiot and you've never clearly never followed the C++ standards committee process. Basically you're bitter because...

      Maybe they should just stick to their failed language and leave the rest of us alone? ...you are actually a genuine failuer. By the way, branding one of the most successful computer languages of the present day and all time as a "failure" does indeed make you look ignorant and bitter.

      The second problem (as if there were only two!) is that they don't update the language to reflect what people what people are doing with it,

      It's a balancing act. No one likes to use nonstandard features. They then add reatures which make writing the type of code that people actually write easier. So they do add features that reflect what people are doing with it.

      That means adding features that no compiler can implement (like exported templates) or feature nobody can or should use (like std::vector or cout/cin)

      My god, you're taking a few missteps from 16 years ago as why the committee today is bad? Is that the best you can do seriously?

      And the only reason they put exported templates in is becuase of all the users clamouring for it.

      Of course they're still full of dumb ivory tower ideas like adopting cairo.

      Bsaically I've come to the conclusion that anyone using the phrase "ivory tower" is an angry, bitter, twisted person. Most likely both opinionated and stupid, but angry because no one will listen to their whitterings.

      --
      SJW n. One who posts facts.
    21. Re:Oh god so what? by suy · · Score: 1

      Err, the implication is that you can also write C++ that is not guaranteed to be maintainable by anybody short of a complete master, which even Bjarne says he is not. I think it is fair to estimate that the number of complete C++ masters in the world is in the single to double digits; no more. It may be you can identify another programming language for which that holds true. I don't think I can.

      You can not even identify one without resorting to factual mistakes. I'm running every day lots of programs written in C++. A simple search on a linux distro reveal thousands of packages in C++. Is that maintained by those "single to double digits" amount of people in the world? Sure.

    22. Re:Oh god so what? by Anonymous Coward · · Score: 0

      'Then again, modern C++ [msdn.com] allows you to also write many things much more elegantly and safely than before.'
              Sure, but can an ordinary human read them without opening the c++ book?

      There is no doubt that the language is powerful and you can build wonderous complex and high performance things with it.
          The other side of the code writing story is the effort required to figure out which of many paths to choose to fit the problem into C++.

      It's been my experience that when a team is given the freedom to pick whatever C++ features make sense to them that they do.
          This means reading the result requires research into a few new cubbyholes of the C++ standard.
          One would think that after years of this, this would sort itself out.
          So far it hasn't. Could be I'm a slow learner, or could be there is a problem with the complexity of the language.
          I think for those of us that are only human, it's a bit of both.

    23. Re:Oh god so what? by fnj · · Score: 1

      Before you go alleging "factual mistakes" over subjective matters, please try to pay attention. Ponder the difference between master and fair to decent practitioner.

    24. Re:Oh god so what? by Eravnrekaree · · Score: 1

      Thats incorrect. Look at the Obfuscated C Code Contest. You can write TOTALLY unmaintainable code in ANY reasonably powerful general purpose language. Such features are necessary to write good software, though of course, anything can be abused.

    25. Re:Oh god so what? by Anonymous Coward · · Score: 0

      Various flavors of assembly language
      Perl
      Python
      JavaScript
      Java ...

    26. Re:Oh god so what? by Anonymous Coward · · Score: 0

      I see a lot of people complaining about the complexity of the language. But it seems that no one dares to give any example.

      Seriously? You need an example of how they took one of the simplest computer languages ever designed and turned it into a language that makes Perl look streamlined by comparison?

    27. Re:Oh god so what? by lgw · · Score: 3, Informative

      So in the real world, you have to understand nearly all of it in order to be able to maintain other people's code or to work as a team.

      If you don't have coding standards and a firm code review process to enforce them, you have already lost.

      C++ has a lot of cruft to allow you to cleanly solve problems that 99% of coders will never encounter. I'd say that these days, if your not in some dark corner where you need at least 1 bizarre C++ feature, you should probably use a higher level language.

      As an example of what I mean - C++ lets you overload the 'new' operator. Why would you ever want to do that? There no reason to learn how that feature works until and unless you need it. But if you need to do "slab allocation" or otherwise change the memory allocation pattern away from "just malloc", suddenly overloading 'new' is an amazingly useful and clean way to do this. In C you have to replace malloc with some other call (or #define malloc notmalloc) and police it everywhere in your codebase, which gets ugly when you have 20 different objects each allocated from its own slab, and gets horrifically ugly when you discover that you need to do this a couple years into a project. In C++ you just overload 'new' on a class-by-class basis.

      C++ has many features like that - stuff that you'd almost never have any use for, but is wonderful when you find yourself in that dark corner. You just need to guard against that guy who just wants to play with some C++ cruft when it's not needed, just because it looks neat.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    28. Re:Oh god so what? by lgw · · Score: 1

      Well, you'd just need a chuckugly type declaration for it. The new ability to use auto in declaring the parameters to the lambda expression itself - that's one I don't see how you'd do without auto, as it's effectively templating in a place where you can't syntactically declare the template.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    29. Re:Oh god so what? by Anonymous Coward · · Score: 0

      std::function greaterThan2 = [](int arg) { return arg > 2; };

    30. Re:Oh god so what? by lgw · · Score: 1

      If you don't use obscure features of C++ just for fun, you won't have that problem. Most of the obscure features in C++ exist to solve a very specific sort of problem. If your job is to solve that problem, you already understand what the relevant C++ feature does - to you it's not obscure, it's quite handy and much cleaner to have in the language than to write an test yourself.

      No one needs to master all the obscure crap, because there's no single software product than needs it all - but all of it is needed by someone, somewhere.

      And if you're being deliberately obscure, well, others have mentioned the C obfuscation contest. No language is maintainable without at least some basic effort to reject needlessly obfuscated code through code reviews.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    31. Re:Oh god so what? by chuckugly · · Score: 1

      For me auto makes the code more readable and maintainable while retaining strong type safety; the type is retained and enforced, it's just determined by the compiler. Having both class and struct on the other hand always struck me as a pointless idea. Having no explicit return type default to int but no explicit argument default to void - also silly. But auto being re-purposed I'm OK with.

    32. Re:Oh god so what? by Anonymous Coward · · Score: 0

      And C is better? Seriously? 99% of C programmers have a problem dealing with "int *** ". The horror hidden in macro's which expand to other macro's? How many C programmers can even correctly describe how those are expanded? Let's not even talk about fixing a bug in one of those. Then compare that to C++ inline functions. 95% of C++ programmers have a decent idea how inline functions inside inline functions work (Just do it).

    33. Re:Oh god so what? by lgw · · Score: 1

      You can definitely over-do auto typing to the point where a human can't figure out the types involved, but that's just a team coding standards thing. For sure, auto is better than any type spec that doesn't fit on a single line in the editor. Obviously class v struct is a historical relic, but I like it. I use class and struct for different things - all members private in the former, vs all public in the latter. I also like the convention that struct is the right keyword to declare an interface, since C++ has no 'interface' keyword.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    34. Re:Oh god so what? by shutdown+-p+now · · Score: 1

      It's a crying shame that C and C++ still haven't added safe arithmetic as part of the standard library (or in case of C, maybe even as part of the language, for the lack of operator overloading). Back when I first saw "checked" in C#, I wondered what this was supposed to be about, but I have since learned the wisdom of having it in the language.

    35. Re:Oh god so what? by shutdown+-p+now · · Score: 1

      Every lambda is of its own unique type. Even if you have two lambdas with the same capture-list and parameters, they're still of different types.

    36. Re:Oh god so what? by shutdown+-p+now · · Score: 1

      You can definitely over-do auto typing to the point where a human can't figure out the types involved

      Thing is, in most cases the human doesn't particularly care about the types involved. Provided that variables are named descriptively, I can look at a piece of code and figure out what it does, without having to determine whether "files" is a vector, a list or a deque, and whether the elements are raw, shared or unique pointers.

    37. Re:Oh god so what? by evan.teran · · Score: 1

      This is an insufficient solution because std::function has a (small) bit of overhead compared to a raw function call. So it is not quite as efficient as simply using auto.

    38. Re:Oh god so what? by dfghjk · · Score: 1

      "If you don't have coding standards and a firm code review process to enforce them, you have already lost."

      Haha. Processes are only as good as the people who implement them. Good code is the result of effort, not policy, and I've seen plenty of "lost" that came out of thorough coding standards and firm code review processes. Nothing overcomes crappy programmers.

    39. Re:Oh god so what? by dfghjk · · Score: 1

      "Any competent C programmer can maintain any C code..."

      In my experience, this is far from true. Depends on the definition of "competent", but then that's true for C++ as well.

    40. Re:Oh god so what? by lgw · · Score: 1

      Processes are only as good as the people who implement them

      Naturally. Your code is as good as the code review process, which is to say, as good as your people and how much they care.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    41. Re:Oh god so what? by lgw · · Score: 1

      Sure, in simple code. But when you have crap like a list of labmdas that take a map and return a vector, or somesuch, because what you're doing is just like that, full type descriptions really help.

      But that's rare, and I'd agree with you most of the time.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    42. Re:Oh god so what? by shutdown+-p+now · · Score: 1

      C++ IDEs have also gotten much better, as well. In Visual Studio these days, you can hover over an identifier, and it'll tell you its actual type, regardless of how many levels of auto there are between it and the actual named type. And it works reliably on anything that is valid C++, no matter the complexity.

    43. Re:Oh god so what? by phantomfive · · Score: 1

      Other successful computer languages do not have that problem. Any competent C programmer can maintain any C code, and the same for python and Java. Perl is arguable; the problem is not complexity but opaqueness.

      I'm not sure that's true. I feel quite certain I can write Java or C code that others will have trouble maintaining (in fact, I already have)

      --
      "First they came for the slanderers and i said nothing."
    44. Re:Oh god so what? by TheRaven64 · · Score: 1

      Clang has some builtins that allow you to get the carry bit, so you can cheaply write code that branches on carry. We (mostly CERT, I helped a bit) had a proposal for inclusion in C11 that would have added qualifiers on integers explicitly defining their overflow behaviour as trapping or wrapping, along with a model that let this be implemented cheaply (e.g. allowing a set of side-effect-free code to propagate temporary results and only trap if one of them along the way overflowed). Sadly, it didn't make it into the standard.

      --
      I am TheRaven on Soylent News
    45. Re:Oh god so what? by macson_g · · Score: 1

      Good luck with your typedefs:

      template<typename Range>
      double mean(const Range& range)
      {
        double sum = 0.0; int count = 0;
        for(auto& v : range) {
          sum += v;
          ++count;
        }
        return sum/count;
      }

    46. Re:Oh god so what? by jeremyp · · Score: 1

      Any competent C programmer can maintain any C code

      OpenSSL is written in C. I am a competent C programmer. I don't think I could maintain that code base. The Open BSD people are probably more competent C programmers than me and they felt they couldn't maintain the code base without first ripping most of it out.

      --
      All I want is a secure system where it's easy to do anything I want. Is that too much to ask ~~ Randall Munroe
    47. Re:Oh god so what? by shutdown+-p+now · · Score: 1

      It didn't make it for C++14, right? My understanding is that C++17 is where the "big things" are supposed to be happening - are you now aiming for that?

    48. Re:Oh god so what? by lgw · · Score: 1

      Cool - I haven't used VS for C++ since they grew up and added C99 support - I really should try it out.

      --
      Socialism: a lie told by totalitarians and believed by fools.
    49. Re:Oh god so what? by shutdown+-p+now · · Score: 1

      C99 support there is still more like 50% (no VLAs, no "restrict", and no complex/imaginary).

    50. Re:Oh god so what? by suy · · Score: 1

      You were implying that using a subset of C++ features is not practical because you could "write C++ that is not guaranteed to be maintainable by anybody short of a complete master", which is absurd, because only a complete master could write that kind of unmaintainable code. Well, according to your logic and your subjectivity, there are only a small amount of people capable of that feat. And the fact that there are lots of C++ programs and libraries out there that are maintainable proves it.

    51. Re:Oh god so what? by TheRaven64 · · Score: 1

      We proposed it to WG14, not WG21. It's pretty trivial to add wrapping and trapping integer templates in C++.

      --
      I am TheRaven on Soylent News
    52. Re:Oh god so what? by Anonymous Coward · · Score: 0

      std::function

  5. Why do we need Auto? by EMG+at+MU · · Score: 2

    I liked a lot of the C++11 features. Lambdas, move semantics, std::mutex, and consistent initializers are all cool things.

    Looking at C++14 I see a lot of expansion of the support of the auto type. I have not found a scenario where I perer auto, so I'm curious about such a large focus on it.

    1. Re:Why do we need Auto? by netsavior · · Score: 0

      Those poor ex-visual basic programmers have suffered through strong typing for too long.

    2. Re:Why do we need Auto? by Anonymous Coward · · Score: 1

      It's rather useful in templates, where the type of an expression can be an arbitrarily-complex function of the parameter types.

      Sure, there are alternatives, but they often require a lot of effort for something which the compiler can do easily.

    3. Re:Why do we need Auto? by Anonymous Coward · · Score: 0

      Or those poor haskell programmers. Oh dear.

    4. Re:Why do we need Auto? by erapert · · Score: 4, Informative

      Herb Sutter responded to this on his blog (Sutter's Mill): http://herbsutter.com/2013/08/...

    5. Re:Why do we need Auto? by Anonymous Coward · · Score: 3, Interesting

      I used to think that, until I realized:

      auto handler = boost::bind(&Class::write_callback, this, boost::ref(timer), boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred);

      /// what is the type of handler?
      boost::asio::async_write(device, buffer, handler);

      Iterators another good one:

      typedef void (*FunctionPtr)();
      std::map<std::string, FunctionPtr> knownCommands;

      /// elsewhere:
      std::string command = "example";

      /// what do you like more?
      std::map<std::string, FunctionPtr>::iterator it = knownCommands.find(command);

      /// or
      auto it = knownCommands.find(command);


      if (it != knownCommands.end()) { /* do something useful */ }

    6. Re:Why do we need Auto? by Anonymous Coward · · Score: 3, Informative

      There are several cases where auto is critical.

      For instance with lambdas, it is no longer even possible to write out the types:

      auto itr = boost::make_filter_iterator([](const Bar &bar) {return bar.foo;},vect.begin(),vect.end());

      The type of itr is boost::filter_iterator, but it cannot be written out because there is no way to enter to the type of the lambda.

      It also eliminates nasty hacks like you see in BGL:

      property_map::const_type pm = get(vertex_index,graph);

      The property_map specialization framework is nasty and complex and conveys no meaning to the caller beyond what 'get' already says. So instead of the nasty property_map we use 'auto' and decltype(get(vertex_index,declval()), which is just as informative to the reader.

      Another good use is to get rid of duplications:

      auto ptr = make_shared(..);

      Is better than the duplicative:

      std::shared_ptr ptr = make_shared(..);

      That isn't even touching how useful it is when working with template meta programming. There are many cases where building up a return type is incredibly complex, and not useful to the reader because the underlying type is obscured by template meta programming anyhow.

      The improvements to auto are mostly fine tuning. Eg return type deduction eliminates the nasty idiom that has developed:

      auto foo() -> decltype(the_return_function(...))
      {
              return the_return_function(...)
      }

      The duplication is very common when using auto for a return.

    7. Re:Why do we need Auto? by kthreadd · · Score: 5, Informative

      Auto does not mean loose typing. It still has a type, you just don't have to write it but it will be there and will be enforced by the compiler.

    8. Re:Why do we need Auto? by Anonymous Coward · · Score: 0

      auto is plenty strong. strong doesn't need to mean redundant.

    9. Re:Why do we need Auto? by Anonymous Coward · · Score: 0

      So, you have a->foo()->bar(). Now, you need to call also a->foo()->baz(). Evaluating foo() is expensive so you don't want to do that twice and its return type is a horribly complex mess of templates and namespaces.
      What do you do? Press magic key and get a list of return types which can be conveniently expanded? duh?

      Except that's the wrong answer. If a language requires you to use an ide to fill out that kind of bullshit, it's a broken language. Thus, auto. (not that it wouldn't still be otherwise horribly broken..)

    10. Re:Why do we need Auto? by fnj · · Score: 1

      This does not address your question specifically, but C++14 fixes some glaring holes in C++11. Well, one hole for damn sure. They clean forgot to put std::make_unique in C++11, even though std::unique_ptr was there. The hole was obvious to anyone who saw std::make_shared and then went to try and look up its obvious complement.

      It was also high time and way beyond high time they added binary constants. Frustrating as hell they STILL found it too hard to support binary formatting in iostreams, though. Evidently it was too hard to add such a dead simple and obvious thing as std::bin, analogous to std::hex. So we already have a hole to fondly hope C++17 (sigh) deigns to fill for us.

    11. Re:Why do we need Auto? by Stele · · Score: 3, Informative

      auto definitely makes writing looping constructs with iterators shorter/easier, without additional typedefs, but by far the nicest use for it is in writing templates, where a specialization or type-dependent mapping my occur in the template using a helper function, and you don't necessarily know what the intermediate type might be. Sure, you could use some complicated typedefs, which may require additional traits classes, but auto handles it nicely.

    12. Re:Why do we need Auto? by Xrikcus · · Score: 4, Informative

      Lambdas are a primary place where auto is there precisely because C++ is a strong, statically typed language as far as possible. The alternative might be polymorphic lambdas, which would require dynamic typing. With auto the type you get, and can propagate through templates, is the type of that specific lambda. With polymorphism the type you'd get is the type of a lambda, from which you'd need to infer which lambda. Auto ensures that with a lambda, though the type is not easily known to the programmer, the type can be statically defined in the code and propagated accordingly.

    13. Re:Why do we need Auto? by godrik · · Score: 1

      I use auto a lot. auto (or equivalent syntax) are used a lot in functional programming languages. Mostly in short functions where I do not really care what the proper typename is. It is clear how the variable behaves and that is I care about it. Often, I know I get some kind of iterator, but the actual type might not be easy to find. In particular, it might depend on a template parameter. So I guess I could add plenty of typedefs to get an easy to write type. But what is the point really?

    14. Re:Why do we need Auto? by Anonymous Coward · · Score: 0

      Personally I like auto when dealing with iterators from the stl containers. Damn those things have long type names.

    15. Re:Why do we need Auto? by Anonymous Coward · · Score: 0

      C++ isn't strongly typed. Read up on various casting as evidence for this. Specifically reinterpret_cast. It's almost as unsafe, if not as unsafe, as good old C style casting. And strongly typed means you can't change the type. If I can change something from a char* to an int with a couple letters inside some parenthesis, it's not strongly typed.

    16. Re:Why do we need Auto? by Anonymous Coward · · Score: 0

      There must be some other benefit... there has to be. Losing code clarity for the sake of saving a few characters is pretty awful.

    17. Re:Why do we need Auto? by ravyne · · Score: 2, Informative

      Auto has other benefits -- firstly, in nearly any case where you would use it, you use it not to avoid stating a type altogether, but to avoid repeating type information that is already stated explicitly or is immediately apparent from the initializing expression (e.g. int x = (int)some_float;) Secondly, in the case of generic code, auto makes it easier to just adapt types to different combinations of template type parameters when that's exactly what you want to do, the alternative has been to maintain these relationships yourself, through what is usually a non-trivial arithmetic of types (including their constness and reference types) and sometimes involving multiple levels of intermediately defined typedefs. Thirdly, some types in C++ actually cannot be stated explicitly (for example, the type of a closure generated from a lambda expression) and auto is the only option if you wish to store or reference one.

      In all cases, the value is strongly typed. The type of a value is set in stone the moment the program is compiled, although multi-types are supported through various library implementations (e.g. Boost::variant, I think is the name of one).

    18. Re:Why do we need Auto? by vux984 · · Score: 2

      C++ isn't strongly typed

      Yeah it is.

      Specifically reinterpret_cast. It's almost as unsafe, if not as unsafe, as good old C style casting.

      Its exactly as unsafe. The difference is that it cannot happen by accident. You are telling the compiler, in very explicit terms that you WANT the reinterpret_cast behavior.

      And strongly typed means you can't change the type.

      Casting doesn't change the type of the thing being cast. It just lets you treat the thing being cast as if it were a different type. typeof(x) never changes.

    19. Re:Why do we need Auto? by shutdown+-p+now · · Score: 1

      The alternative might be polymorphic lambdas, which would require dynamic typing.

      Polymorphic lambdas (which were added in C++14, in fact) don't require dynamic typing. They only require the ability to use template parameters for lambda arguments. In case of polymorphic lambdas, this is implicit (i.e. basically you can elide the type of the function parameter, and it will become a template parameter on the operator() for the type generated for that lambda).

    20. Re:Why do we need Auto? by the_arrow · · Score: 1

      typedef void (*FunctionPtr)();
      std::map<std::string, FunctionPtr> knownCommands;

      While on the subject of C++11/14, why not use std::function instead of a function pointer?

      --
      / The Arrow
      "How lovely you are. So lovely in my straightjacket..." - Nny
    21. Re:Why do we need Auto? by Xrikcus · · Score: 1

      You are indeed correct. Polymorphic lambdas as defined in C++ only apply template polymorphism to them. That's a subset of the possible forms of polymorphism, but I shouldn't really have used the term given that it has a definition in the standard now. Java lambdas (or C++ std::function wrapping of a lambda) is a different situation - those are only statically typed to the point of the interface, so any use of the lambda has to rely on a more dynamic typing mechanism (virtual function calls, maybe JIT inference), which is the situation I was alluding to.

    22. Re:Why do we need Auto? by shutdown+-p+now · · Score: 1

      I believe this kind of polymorphism is already possible, between std::function and boost::any (and, of course, they're planning to add "any" as part of the standard in a future version).

  6. C++14 dating is a lie! by Anonymous Coward · · Score: 0

    C++14 can not be used to date someone. Believe me, I've tried:
    #include "your roommate"
    #define SAFEWORD pineapple
    int main(void) {
    exit 1;
    }

    And that's as far as I get without compiler errors. Maybe I should try older. Anyone know a way to discover age of carbon based things?

  7. Hmmm by Anonymous Coward · · Score: 0

    What you C++14 is what you get.

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

      Carbon 14 set in stone. Just the thing to confuse future archeologists.

  8. Where are my designated initializers? by Tough+Love · · Score: 3, Insightful

    It's just pathetic that so many years down the road the committee can't get its act together to provide this much loved C99 feature at least for POD. This is a major issue, if not the major issue) with porting C code. The word wanking comes to mind. Here, GCC guys really need to take the lead but it's starting to feel like GCC guys are actually holding back on it. It's not like the coding is a challenge.

    --
    When all you have is a hammer, every problem starts to look like a thumb.
    1. Re:Where are my designated initializers? by UnknownSoldier · · Score: 1

      You want the committee to focus on practical problems?! LOL. You are more delusional then them! :-)

      Recently they wanted to add a 2D graphics API to the language! Yeah, let's re-implement OpenGL ES.
      http://developers.slashdot.org...

      This is your typical design-by-committee of a "Solution looking for a Problem". God forbid we actually have _standardized_ pragmas like we do for OpenMP.

      The committee has only one motivation:

        "Job security by obscurity."

      C++ has a become a total cluster-fuck of over-engineering. It jumped the shark back in 2000 when they forgot the mantra of GOOD programming & design:

          Keep it simple, stupid!

      D seems to clean up some of this crap but sadly it not properly supported across multiple platforms.

    2. Re:Where are my designated initializers? by fnj · · Score: 1

      HEAR, HEAR!!! [Pounds fist on table repeatedly]. I have been dying for this since gcc added the nonstandard extension and then C99, seems a lifetime ago, codified it in the C standard. What the HELL, guys. With all the wang-yanking ivory tower crap they did implement in C++11 and 14, much of it very hard work to master using, let alone implementing, is there any way in hell you can blame us for calling you out on the immature assholery of not simply copying this dead-simple feature from C99?

      This should have been the number one improvement put into C++03. Leaving it out of 11 was unforgiveable, and leaving it out of 14 is goddam obstruction.

      And yeah, I agree with you, gcc not adding it as a nonstandard C++ extension is sick. Particularly if clang and maybe Microsoft joined them and they all tried to shame the C++ standards committee.

    3. Re:Where are my designated initializers? by Stele · · Score: 1

      Maybe it's not part of C++ because this kind of initialization is trivial to do, and more readable, with helper classes and constructors. Just a theory - I wasn't even aware of designated initializers.

      What I find pathetic is all of the C programmers who still think C++ is slow, bloated, or impossible to understand.

    4. Re:Where are my designated initializers? by jones_supa · · Score: 1

      Recently they wanted to add a 2D graphics API to the language! Yeah, let's re-implement OpenGL ES. http://developers.slashdot.org...

      Zee wot? Cairo is nothing like OpenGL ES.

    5. Re:Where are my designated initializers? by Anonymous Coward · · Score: 0

      Also, some of the people of the committee would like to have a standardized API for text messaging. "Da Fuq" was, obviously, my first thought.

    6. Re:Where are my designated initializers? by Tough+Love · · Score: 1

      Maybe it's not part of C++ because this kind of initialization is trivial to do...

      It is a safe bet that you have never ported a C99 program of any significance to C++.

      --
      When all you have is a hammer, every problem starts to look like a thumb.
    7. Re:Where are my designated initializers? by Anonymous Coward · · Score: 0

      I was just reading the Herb Sutter explanation of "auto" linked to earlier in this thread and pretty much everything I saw that was good only applies to C++ (and not C, or the other languages I use), because of the failings of C++. If everything you do can be defined in terms of generic operations - e.g., "find", "sort" -- and the ramifications of those operations are obvious, then C++ is great; if not, it's a kitchen sink filled with feces.

    8. Re:Where are my designated initializers? by mbkennel · · Score: 1

      I'm a C++ programmer.

      C++ is (usually) fast, bloated and almost impossible to fully understand.

    9. Re:Where are my designated initializers? by Anonymous Coward · · Score: 0

      > at least for POD

      This may provide a clue as to why this hasn't been a priority.

      In C, all types are POD types. In C++, they're uncommon, and becoming even less common as the set of features which makes a type not a POD type continues to grow.

    10. Re:Where are my designated initializers? by Yunzil · · Score: 1

      Please explain how a helper class is trivial compared to a simple inline initialization.

  9. Still... by slashdice · · Score: 1

    // comments are in the c99 standard.

    --
    Copyright (c) 1990 - 2014 Dice. All rights reserved. Use of this comment is subject to certain Terms and Conditions.
  10. Oh god so what? by slashdice · · Score: 1
    The problem (as if there's only one!) is that the c++ committee members only have one thing in common: They hate C!

    So you get a mix of people trying to bolt their favorite features from cobol, haskell, java, etc onto C. You know, to improve it. Maybe they should just stick to their failed language and leave the rest of us alone?

    The second problem (as if there were only two!) is that they don't update the language to reflect what people what people are doing with it, they update the language to reflect what they think people should do with it. That means adding features that no compiler can implement (like exported templates) or feature nobody can or should use (like std::vector<bool> or cout/cin). I think they've started getting a little bit better in this regard, adopting better parts of boost rather than just making shit up. And clang++ implements draft proposals and provides feedback. Of course they're still full of dumb ivory tower ideas like adopting cairo.

    --
    Copyright (c) 1990 - 2014 Dice. All rights reserved. Use of this comment is subject to certain Terms and Conditions.
  11. only 45 years to approve binary literals? by 4wdloop · · Score: 1

    ...but I am glad they are here!
    (yes gcc has them already...)

    --
    4wdloop
  12. What about by MouseTheLuckyDog · · Score: 1

    concepts?

    1. Re:What about by godrik · · Score: 1

      Indeed! Where are concepts! These is the number 1 addition to C++ most of us need! I am sure that they were not added for a good reasons. But programming template is currently a nightmare because of the duck typing of the meta programming system.

      Dear standardization committee, we NEED a solution to the template compile time debugging problem.

    2. Re:What about by rockmuelle · · Score: 1

      Yes!!! I wish I had mod points. They basically had them ready to go for C++11 and then committee infighting killed them (Bjarne stubbornly backed the wrong horse - not that I have a strong opinion on this or anything ;) ).

      Syntactic support for generic programming would be the single best addition to C++ to breathe new life into the language and get a whole generation of developers who've written it off interested in it. Generic programming is as paradigm shifting as OOP. It just kills me that it's so thoroughly obfuscated by template meta-programming in C++.

  13. C++ set in stone by doti · · Score: 3, Funny

    now we just need to throw the stone in the Marina Trench.

    --
    factor 966971: 966971
    1. Re:C++ set in stone by blackiner · · Score: 2

      But then it would be clogged up!

  14. Garbage collection without smart pointers by Anonymous Coward · · Score: 0

    Still no automatic garbage collection without smart pointers.

    1. Re:Garbage collection without smart pointers by Anonymous Coward · · Score: 0

      Sure there is, but not the way you'd expect.

      It automatically collects the garbage programmers who can't discipline themselves to understand and manage the scope of an allocated object's lifetime. It then discards them from the language's user base, leaving behind only those who can clear this rather low bar of competency.

    2. Re:Garbage collection without smart pointers by shutdown+-p+now · · Score: 1

      If you really can't live without it, there's always libgc.

  15. Binary literals by Anonymous Coward · · Score: 0

    And it only took 30 years to implement.

  16. Go Issaquah by Anonymous Coward · · Score: 0

    Washington state baby yeah :)

  17. rodata vs. data section by tepples · · Score: 1

    this kind of initialization [performed with C99 designated initializers] is trivial to do, and more readable, with helper classes and constructors

    A designated initializer for static data can initialize data in a read-only section. "Helper classes and constructors" mutate an object, which inflates the size of your program's read-write section.

    1. Re:rodata vs. data section by Stele · · Score: 1

      Good point!

    2. Re:rodata vs. data section by Anonymous Coward · · Score: 0

      No, it doesn't. C++ has constexpr (since '11). You can use entire temporary objects in the initializer.

      Of course, using .rodata has always been a Quality Of Implementation issue in both C and C++. Copying everything to RAM is not an observable side effect, formally.

    3. Re:rodata vs. data section by tepples · · Score: 1

      Of course, using .rodata has always been a Quality Of Implementation issue in both C and C++.

      Then perhaps Tough Love's point is that an acceptable quality of implementation is achievable with less complexity with C99's way than with C++11's way. A language is only as good as its best free implementation.*

      Copying everything to RAM is not an observable side effect, formally.

      This is true given plenty of memory on the target machine, such as a modern desktop PC, but it becomes observable in a smaller machine. If your program uses more RAM, then the amount of work done per unit of std::time() decreases as it starts to dip into swap, or it catches an exception of type std::bad_alloc sooner, or it's OOM-killed sooner.

      * Why free? Without at least two implementations, one distributed as source code, one cannot detect a Ken Thompson-style compiler virus using David A. Wheeler's diverse double-compiling method.

  18. Back to the future by T.E.D. · · Score: 5, Funny

    with some new features like function return type deduction,

    Hey, K&R C had function return type deduction back in the 70's .

    ...of course it always guessed "int", but IT HAD IT.

    1. Re:Back to the future by shutdown+-p+now · · Score: 1

      In fact, B had it as early as 1969, and it was 100% correct even on arbitrarily complex programs!

      (It always inferred type "machine word", which was the only one that the language had.)

  19. Dispose pattern by tepples · · Score: 1

    What kind of automatic garbage collection do you want? The tracing garbage collection seen in Java and Python is fine for memory, but most programs access resources other than memory. Java and Python* don't guarantee that finalizers will ever be called. This means a program relying on automatic garbage collection leaks resources unless the programmer is disciplined enough to apply the dispose pattern consistently. True, Java and Python provide syntactic sugar for the dispose pattern within a single block of code. But when an object's lifetime exceeds one block of code, such as when an object holds a reference to another object, the programmer's conceptual overhead of the dispose pattern is at least as large as manual object lifetime management in C++.

    * CPython calls the __del__ method on anything not held cyclically because its reference semantics resemble C++'s std::shared_ptr, but other Python implementations can and do behave differently.

  20. Don't trust this polluted 'standard' by Anonymous Coward · · Score: 0

    After all, this is the organization that accepted open corruptions that created the monster known as OOXML, and then expect people to pay hundreds just to take a peek at this so-called 'standard' that even M$ wouldn't really use it except to sabotage ODF.

  21. The worst joke foisted on programmers in history by Squidlips · · Score: 0

    C++ has always been a steaming pile of hacks build on top of an insecure, unsafe language that was glorified assembler. No amount of new hacks on top of the old hacks will ever fix this software disaster. It created one software disaster after another such as Netscape 6.

  22. Silicone? by beernutz · · Score: 1

    I think you mean Sillicon

    silicone:
    Any of a class of synthetic materials that are polymers with a chemical structure based on chains of alternate silicon and oxygen atoms, with organic groups attached to the silicon atoms. Such compounds are typically resistant to chemical attack and insensitive to temperature changes and are used to make rubber, plastics, polishes, and lubricants.

    --
    (stolen from DaBum) I am dyslexia of borg - your ass will be laminated.
    1. Re:Silicone? by beernutz · · Score: 1

      Edit: Cant seem to spell Silicon properly. lol

      --
      (stolen from DaBum) I am dyslexia of borg - your ass will be laminated.
  23. C++14 Is Set In Stone? by Jeremiah+Cornelius · · Score: 2

    Now, to drop it off a bridge, into the East River!

    --
    "Flyin' in just a sweet place,
    Never been known to fail..."
  24. I wonder if... by ctrl-alt-canc · · Score: 1

    ...C++14 decays to N++14 as well.

  25. Shared libraries anyone? by Plouf · · Score: 1

    I mean like supporting writing of shared objects without having to deal with inconsistent mangling approaches between compilers, having to resort to manually-maintained export files? Or having to use the exact same version of the compiler between the library and the code using it? Being able to expose functions throwing exceptions through a library (gasp! who wants to do that?) or to reliabily use an std container through the library interface?

    Without all this, you can't write C++ code spliting the logic into multiple binaries in a platform-independant way...

    This is the main reason why all libraries are still written in C, or at least expose interfaces in C.

  26. C++ is great but by szir · · Score: 1

    I must confess I'm not a C++ master (more like a beginner).
    But I have written code in many languages:
    Assembly (x86, x64, AVR, ARM)
    asp, asp.net
    Basic (think Commodore 64)
    Batch script :)
    C
    C++
    C#
    Clipper (anyone)
    D
    Delphi
    Java
    Javascript
    Lua
    Matlab
    Pascal
    Perl
    Php
    Python
    Shell script
    VB script
    Verilog
    VHDL

    I have not yet used but I'm interested in F# and Go. (async and concurrent programming among other things)

    I think C++ lacks certain features, native data types, and (a feel of) simplicity that other modern languages have.
    For example I like Pascal style strings much more where you can determine it's length in O{1} time among other things (return, concate, resize). (same for arrays, where in C you have to pass length separately, and hope you won't cause buffer/stack overflow)
    Template meta-programming is a great, sometimes magical tool
    (which you can dig your grave with if you are not careful -- debugging, maintaining, understanding, editor intellisense).

    I do not expect anyone to start programming in assembly, I wouldn't. Though there are High Level Assemblers out there, (the lack of) portability is a major disadvantage of it.
    But I have not yet worked on a processor that had not supported carry flag, and I do not know any way to access it from native C code. (Lets say shifting a 1024 bit integer, adding, subtracting them....) Checking for integer overflow is also a pain in the ass (pre check/post check. And I have not found any way writing my code that would get the compiler to produce the right assembly.) Also on processors I worked on multiplying 2 registers results in a register pair because that't how multiplication works and extends the range of possible results (and this is why there is a carry flag used during addition), but C is blissfully or painfully ignorant of this (depending where you are looking it from) and this is usually where code readability starts going down the toilet when you are precasting integers and alike. (When you need to multiply two 32 bit int (and maybe then divide it so the result is still 32 bit), but you cast it to int 64 pre multiplication, will it result full 64 bit multiplication (software multiplication on 32 bit processor)?)
    But I guess code efficiency does not matter and that is why we have longer response times now on GHz processors, than we had on 486... (and of course because of bling)

    Reading code examples about why you need auto in the comments makes me cry. WTF is boost::asio::placeholders::bytes_transferred!? (It was a rhetorical question, don't answer it:)
    This is what the improved readable code looks like?

    So C is not close enough to hardware to understand it and generate efficient code, and not high level enough to abstract and understand things that humans would like to use naturally. We have to think in bits and clocks to write some broken codes.

    I'm an embedded developer so I'm stuck with C (and C++) for now.

    1. Re:C++ is great but by Anonymous Coward · · Score: 0

      C++ strings work similarly to Pascal strings, but are somewhat more versatile (no length limit) at the cost of extra mechanism. They've been an official part of the language for about 16 years now. In my opinion, using C-type strings and arrays in C++ is almost always a mistake, except when communicating with third-party libraries. C++ is higher level than C, and does a much better job of abstraction.

      Back when C was invented, there was a dazzling array of CPUs, not all of which did the same thing with arithmetic overflows and register multiplication. (Two things you can reasonably do with arithmetic overflow: set the carry bit, or raise some sort of exception.) The variety has been trimmed down (does anybody still use ones' complement?), and it may be useful to introduce a C variant that makes more assumptions about the CPU.