I just recently came across Shift Operators and it interests me. Though I'm beginning to learn more about it, I'm still a bit confused as where to implement them. However, the problem I'm facing is because of an example I found on MSDN
// expre_Shift_Operators.cpp
// compile with: /EHsc
// Demonstrate shift operators
#include <iostream>
using namespace std;
int main() {
cout << "5 times 2 is " << (5 << 1) << endl
<< "20 divided by 4 is " << (20 >> 2) << endl;
}
When I follow the instructions on a Visual Studio Command Prompt, It worked flawlessly, however, when I tried it on GCC compiler, it generated a long list of errors. It also worked correctly on GPP compiler.
Compiling on cl.exe with /EHsc:
5 times 2 is 10
20 divided by 4 is 5
Compiling on GCC:
Attached Error List