On Sat, Nov 16, 2019 at 11:23:33PM +0800, Xi Ruoyao wrote: > On 2019-11-16 08:26 -0600, Segher Boessenkool wrote: > > You should have warnings enabled *always*. It does not take extra > > time, > > not measurable anyway. The point is that the compiler will tell you > > about likely errors you made, right after you made them, so it is > > easy > > to correct then, and a huge time saver. And if the compiler think > > that > > something may be wrong, but it really all is perfectly fine, perhaps > > the > > code should be written in such a way that this is more clear. > > Regarding this, is it worth considering to make -Wall the default? > > Recently our team is training some freshmen to write programs in C/C++. > They often make some bugs (invoking UB in some way) and puzzle > themselves. But we noticed that 90% of their bugs can be diagnosed by > simply adding -Wall. It will be very disruptive to all users who do *not* want -Wall (misguided perhaps, but that's not the point), and to build systems (including those that cannot be fixed, think compiling older software with a new compiler). Not to mention the GCC testsuite itself... Making that work should give us some feel for how annoying changing the default is. I agree it is a nicer default, but how do we get there without a lot of pain? Segher