News for hackers. Stuff that matters.
Re:The Design of C++ (1994) [video] by KKKKkkkk1 on Saturday September 10, 2016 @11:08AM (#12469562)
Let's bring up some technical details to see whether there is a deliberate thought process behind the evolution of C++. Recent versions of C++ have the auto keyword. It's a cool new feature grafted onto C++ from other languages and meant to make the programmer's life easier. It lets you avoid typing things like

  for (std::vector<std::pair<int, double>>::const_iterator it = v.begin(); it != v.end(); ++it) {
    foo(*it);
  }
The above used to be the recommended way to write a loop until C++11, and was supposedly superior to

  for (int i = 0; i < v.size(); ++i) {
    foo(v[i]);
  }
which was considered to be error prone and unsafe. But now things are much nicer and you can write

  for (auto x : v) {
    foo(x);
  }
Looks so much better. Clearly "auto" is a win for C++ programmers. But wait, it turns out that there's actually a bunch of different ways of writing the auto keyword that have subtly different semantics. You can write "auto", but you can also use every possible combination of "auto" with "const", "&" and "&&". So things like "auto&&" or "const auto&" are also perfectly valid and sometimes preferable to simple old "auto".

Let's put aside the fact that you can't explain the difference between "*", "&" and "&&" to a C programmer without them bursting out laughing. Why does auto have six different variants? Isn't this emblematic of how C++ is evolving?

Re:The Design of C++ (1994) [video] by dTal on Sunday September 11, 2016 @03:59PM (#12475328)
As a light C programmer, no part of this post does not make me WTF hard. Would I actually be expected to type that cataclysm at the top? What's wrong with the C-style loop? Was 'auto' the best name they could come up with for this feature?
Re:The Design of C++ (1994) [video] by hawski on Monday September 12, 2016 @07:43AM (#12478855)
They have chosen auto, because it was already a reserved keyword, but it was practically useless.
Re:The Design of C++ (1994) [video] by pjmlp on Saturday September 10, 2016 @12:39PM (#12469919)
At least C++ offers me tools to avoid leaking resources or corrupting memory, which cannot be said for C.

The fact that C11 made the security Annex optional, is a sign how much the C committee values writing safe code.

Re:The Design of C++ (1994) [video] by stinos on Saturday September 10, 2016 @01:53PM (#12470231)
for (auto x : v) {

usually you'd use for(const auto& : v) though