<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 11, 2013 at 11:54 AM, Arthur O'Dwyer <span dir="ltr"><<a href="mailto:arthur.j.odwyer@gmail.com" target="_blank" class="cremed">arthur.j.odwyer@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">> My preference would be to have '-O' be the fallback, and that in turn be<br>
> equivalent to '-O2' which is often viewed as a reasonable default level of<br>
> optimization.<br>
<br>
</div>Note that the commit message is no longer 100% non-misleading. The<br>
message actually given by the code is "optimization level '-O20' is<br>
unsupported; using '-O3' instead."<br>
<br>
The English semantics aren't "oh no, we don't know the user's intent,<br>
let's do something sensible instead." The English semantics are more<br>
like "aha, the user explicitly requested CRAZY HIGH levels of<br>
optimization; let's give him the highest level we currently support."<br>
<br>
Existing projects use things like -O99 for this purpose.<br>
<br>
You would probably agree that it doesn't make sense to have -O4<br>
perform fewer optimizations than -O3, right?  That's what would happen<br>
if you made -O4 (-O5, -O99) equivalent to -O2.  (Also what Hal said.<br>
:))</blockquote></div><br>Actually, no, I disagree with your conclusions.</div><div class="gmail_extra"><br></div><div class="gmail_extra">I think the far and away most likely reason for a number greater than 3 is using a numbering system from a compiler other than GCC. I have no idea what 4 or 5 map to for those. Maybe they map to something like -O3, maybe not.</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">I think assuming that these optimizations are ordered in some way based on "fast" is wrong. For *many* C++ codebases -O2 produces consistently higher quality code than -O3.</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">If we're going to *do* something when we do not understand the specific nature of the user's request, I would like us to do the most generic thing with the fewest assumptions. All we know is that the user wanted *some* optimization, not how much. Let's pick our default for "some" optimization.</div>
</div>