Reputation: 25
I see that there is quite a bit of difference in the syntaxes of newer versions of compilers. For example, a syntax that works on c++11 doesn't work on c++98.
#include <iostream>
#include <vector>
int main()
{
// Create a vector containing integers
std::vector<int> v = {7, 5, 16, 8};
// Add two more integers to vector
v.push_back(25);
v.push_back(13);
// Iterate and print values of vector
for(int n : v) {
std::cout << n << '\n';
}
}
the above syntax of for() loop doesn't work on c+++98. Also, the vector IN c++98 needs to be initialized first using a constructor. So, should I use the latest versions of the compiler, or stick to the one that my teachers are using?
Upvotes: 2
Views: 704
Reputation: 664
Why do you want to even use the c++98 compilers ? C++ has evolved to a great extent now. You should use the newest compilers to be up-to-date with the language. There are many robust features which were not present at the time of c++98. Therefore, you should use the newest compilers for learning.
Upvotes: 2
Reputation: 2038
Unless you have an explicit reason to use an outdated version of C++, use the newest standard that's implemented for your compiler, as of now that's C++ 17 for gcc, clang amd msvc, C++20 is WiP.
Upvotes: 2