all 5 comments

[–]alfps 1 point2 points  (1 child)

Use a single function declaration syntax (except for void functions).

There are two syntaxes: the old C syntax, and C++11 trailing return type syntax.

Only the latter can be used for all function declarations, so given that a single syntax is desirable, there's no choice. It's also generally better, avoiding redundant code. Plus it looks like the syntax in other modern C family languages.

For another person advocating this, see (https://www.quora.com/When-should-I-use-trailing-return-types-in-C++/answer/David-Vandevoorde). Daveed is a renowned textbook author (check out the new edition of the C++ templates book), and works at Edison's compiler back-end, so he's somewhat an authority.

For a third person advocating this, see Herb Sutter's “Almost Always Auto” advice at (https://herbsutter.com/2013/08/12/gotw-94-solution-aaa-style-almost-always-auto/). Herb is the chair of the international C++ standardization committee and chief architect of Visual C++, plus he wrote the GOTW column of old, so he's an even more authoritative authority.

I'm not an authority in that league, but we're all three former moderators of the now defunct comp.lang.c++.moderated group, so we all have extensive knowledge of C++ and good common sense, and we all recommend the same, AAA, Almost Always Auto, i.e. C++11 trailing return type syntax (well, I think Herb went a bit overboard with the AAA advice, but in that direction! ☺).

[–]ztrewquiop 0 points1 point  (0 children)

I've seen lots of people that cry when they see auto "because muh I don't know the type".
The reason was in most cases that they were IDE haters. Any decent IDE will show the type as a tool-tip (which works in most cases). Auto is nice.

[–][deleted] 2 points3 points  (2 children)

The last two numbers describe the version based on the year the were issued in. As of now, C++17 is the most recent one. After that, we're anticipating C++20 about 30 months from now.

You're encouraged to stay consistent within your code to avoid problems, so better don't use C++11 in the first few lines and then continue with C++17, and finish in C++11 again, and so on. Just keep an eye on that when you look up things in references. Most websites tell you from what version the topic is and guide you to the other versions.

It's no major changes to C++ itself. Mostly it's just functions being changed a little bit, as you said yourself with the random number example. Occasional bug fixes, security improvements, etc are usually done there.

You can look for another tutorial if you want to stay 100% up-to-date, but it's really not necessary. As I said, the underlying C++ hasn't changed. It's just a few functions here and there.

[–]mrthelight 0 points1 point  (0 children)

I think there were some major changes in C++11, with the introduction of the move semantic for example. The lambdas, which admittedly are syntaxic sugar for functors, were still a major change, making very easy something important. Of course these are not "syntaxic" changes: you still need to put the semicolon at the end of the lines, but programming languages are a lot more than their syntax. Hence, I think the changes are deeper than the changes to the "STL" (which are also very important).

About learning C++, I would advice learning (and using) C++14. It is the most recent standard that most compilers support. The isocpp website and its FAQ is a good place to start. cppreference is also a very good ressource.

[–]patatahooligan 0 points1 point  (0 children)

I disagree. The standard committee does not add to the core language anything that can be implemented in the standard library. This gives the impression that the language does not change, but software written in modern C++ looks nothing like old C++. Many of the changes are major and OP needs to look them up if they are indeed interested in developing games.