by mattnewport · 9y ago · 0 comments
I should revisit the topic in light of the latest progress with C++ and to correct some errors in those posts but I continue to believe that C++ is getting better as a language for games.
There is a somewhat legitimate argument that C++ is too complex but I don't believe you can make a convincing case that it justifies creating a whole new language (which will inevitably come with its own quirks, idiosyncracies and complexities) rather than engaging with the development of C++ itself.
why should it ? Adding features is enough for simplifying stuff.
eg take the following code:
for(auto& val : {1,3,12,17,20}) { val++; }
it leverages three new features: auto, range-based for, and braced initialization.How would it look in cpp03 ? Two possibilities:
std::vector<int> v;
v.push_back(1); v.push_back(3); ... v.push_back(20);
for(std::vector<int>::iterator it = v.begin(); it != v.end(); ++it) {
(*it)++;
}
Or int v[] = {1,3,12,17,20};
for(int i = 0; i < (int)(sizeof(v)/sizeof(int)); i++) {
v[i]++;
}