How can I compile only standard C ++ with GNU g ++?

GNU g ++ compilers have some extensions, such as VLA (variable length arrays), although these functions are not C ++ standards.

So, if I need to compile a program using only standard C ++ constructors and avoiding these additional extensions, can I do this with GNU g ++?

Something like g++ test.cpp -std=onlyStandards ?

+6
source share
1 answer

Pass the -pedantic-errors flag. Be sure to set the standard with -std= , for example, -std=c++14 . This also works in clang.

+10
source

Source: https://habr.com/ru/post/976197/


All Articles