How can I set the g++ compiler in Windows so that he won't compile if what I am writing is not pure C++ standard?
You cannot. I agree with most of what @Lightness said in his answer. It is not the compiler's job to warn you of all the ways you might be invoking undefined behaviour (some of which aren't even detectable at compile time).
However, I do not agree with the part of his answer where he equates -Wall -Wextra -pedantic
with "warnings turned up way up high".
Quoting from the GCC manuals (v5.2) on what the options actually mean, emphasis mine:
-Wall
This enables all the warnings about constructions that some users consider questionable, and that are easy to avoid [...]
-Wextra
This enables some extra warning flags that are not enabled by -Wall.
-pedantic
Issue all the warnings demanded by strict ISO C and ISO C++ [...]
Not all constructs that are "not pure C++" actually demand a warning by the standard. There are many things that even -Wall -Wextra -pedantic
will not protect you from, and many things that are quite likely programming errors but not covered by the standard (e.g. -Wsign-conversion
, -Wswitch-default
, -Wlogical-op
, -Woverloaded-virtual
...)
So the recommendation here is, pick up the compiler manual, and check all the available warning options, selecting the strictest set you can live with. Repeat that process regularly.