+ 1

Different compilers matter?

Hello, fellow programmers. I have been programming C++ from about 2 years now, so i have compiled many programs on many different compilers. But the thing is that i am unable to execute some specific statements like for loop and while loop as some compilers deny the way i code. so, basically why does the compilers wary the codes that we write?

14th Apr 2017, 12:08 PM
DEVIL kingg
DEVIL kingg - avatar
1 Answer
+ 1
Some compilers automatically enable standards like c++11 or c++14, while others need an additional argument to compile with these standards. For example, in g++ you need to use the argument -std=c++11 when compiling to enable the new FOR style that iterates a container.
14th Apr 2017, 8:11 PM
Denis Felipe
Denis Felipe - avatar