r233981 - Unify warnings/errors from "maybe you meant" to "did you mean".

Dmitri Gribenko gribozavr at gmail.com
Sat Apr 4 18:12:52 PDT 2015


On Sat, Apr 4, 2015 at 1:39 PM, Arthur O'Dwyer
<arthur.j.odwyer at gmail.com> wrote:
> Since we're bikeshedding, I'm personally strongly opposed to compiler
> error messages that *ask questions of the user*, given that the
> process is not actually an interactive one.  The wording "Maybe you
> meant..." (a declarative sentence) seems to me infinitely preferable
> to "Did you mean...?" (an interrogative one).
>
> Also, the fact that "Did you mean...?" ends with a question mark means
> that the end-of-sentence punctuation could easily get confused with
> (or accidentally cut-and-pasted into) the actual program text.
>
>     foo.c:3:'if' cannot be used here; did you mean 'x ? y : z'?
>
> Software should be friendly, but it shouldn't ask questions of the
> user unless it's prepared to accept different answers and act on them
> accordingly.

Clang usually emits fixits for 'did you mean' diagnostics, and there
are IDEs that would apply the fixit if the user agrees.  Thus, I find
this pattern quite appropriate.

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/



More information about the cfe-commits mailing list