On Fri, 10 Jul 2020 at 00:58, Jonathan Wakely <jwakely.gcc@xxxxxxxxx> wrote: > > On Thu, 9 Jul 2020 at 23:54, Jonny Grant <jg@xxxxxxxx> wrote: > > > > Hello > > > > I noticed g++ ignores -W as I understand it that alone doesn't turn anything on? > > No, -W is identical to -Wextra. > > > https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html > > > > Also may I ask if specifying both -pedantic -Wpedantic be an error? They are the same as I understand. g++ doesn't reject them both being specified. > > They mean the same thing. It's not an error to repeat options. > > > Another example is -O1 -O0 -O3, the later -03 seems to be used. Maybe nice to say too many optimization options specified? > > No, it's common (and very useful) to append an option to the end of a > command and have it override earlier options. > > This behaviour is documented, and relied on by many people. The manual says "If you use multiple -O options, with or without level numbers, the last such option is the one that is effective." Similar wording exists for -g options.