public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* messaging
@ 2009-04-13 22:30 Arthur Schwarz
  2009-04-14 13:02 ` messaging Kai Henningsen
  2009-04-23  5:50 ` messaging Ian Lance Taylor
  0 siblings, 2 replies; 9+ messages in thread
From: Arthur Schwarz @ 2009-04-13 22:30 UTC (permalink / raw)
  To: gcc


In the following code fragment:

# include <ios>
# include <fstream>
# include <istream>

using namespace std;
void CommandLine(int argc, char** argv);
int main(int argc, char** argv) {
   CommandLine(argc, argv[]);
   ifstream x.open(argv[1], ios:in);
   ofstream y.open(argv[1], ios::in);
   
   return 0;
};

g++-4 messaging is:
>> g++-4 x.cpp
x.cpp: In function 'int main(int, char**)':
x.cpp:8: error: expected primary-expression before ']' token
x.cpp:10: error: expected primary-expression before ':' token

A recommendation and reason for change is:
1: x.cpp:8 error: illegal to pass an array without subscript value as an 
   argument
   The given message is accurate but non-expressive of the reason
   for failure.
3: cpp:10 error: illegal scope resolution operator ':'
   From memory, there are three uses of ':' in C++
   ':'   label terminator, <label>:
   ':'   case in a switch statement, case <value>:
   ':'   scope resolution operator, "::"
   The given diagnostic message is deceptive. 

art

^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: messaging
@ 2009-04-14 16:58 aschwarz1309
  2009-04-14 19:34 ` messaging Kai Henningsen
  2009-04-14 22:21 ` messaging James Dennett
  0 siblings, 2 replies; 9+ messages in thread
From: aschwarz1309 @ 2009-04-14 16:58 UTC (permalink / raw)
  To: Kai Henningsen; +Cc: gcc


Thanks Kai. I do have what I hope is a more specific subjective reason for saying that I think the existing diagnostics should be changed. Fundamentally, what is provided in the messaging is not an indication of what is wrong, but an indication of what is required to repair the fault. My objections then become:
1: As an old man full of wisdom, most developers can't distinguish a
   'primary-expression' from a washing machine. Further, to determine
   what correction might be needed most users would have to research
   the C++ standard (or other standardized document supported by the
   g++ development community) to find out exactly what constitutes a
   'primary-expression'. 
2: It puts an obligation on the g++ development community to ensure
   that the messaging is consistent with documentation and that if the 
   term 'primary-expression' changes then g++ will change the messaging
   to conform to the new term. 
3: The cause of the error is more specific than it's solution. The cause
   of the fault is the user (in this case me) provided something that
   was wrong. It wasn't the lack of a 'primary-expression' but the
   existence of the illegal constructs. My conjecture is that if the
   message says "you did this wrong" then the user would have an easy
   time of finding a fix.

I don't argue with the details of my wording. My intent is not to show that I am a better wordsmith but that the existing diagnostic messages are not specific enough. From Item 1: above, in order for the average user to fix the error the user must research the terms used, then compare the syntax given with the actual fault, and then fix the error. If the message say "this is the fault", the research goes the way of the woolly-mammoth.

The paradigm is that the message should provide the minimum amount of information required to identify the syntax/semantics which caused the failure.

art

--- On Mon, 4/13/09, Kai Henningsen <kai.extern@googlemail.com> wrote:

> From: Kai Henningsen <kai.extern@googlemail.com>
> Subject: Re: messaging
> To: "Arthur Schwarz" <aschwarz1309@verizon.net>
> Cc: gcc@gcc.gnu.org
> Date: Monday, April 13, 2009, 11:12 PM
> Arthur Schwarz schrieb:
> > In the following code fragment:
> > 
> > # include <ios>
> > # include <fstream>
> > # include <istream>
> > 
> > using namespace std;
> > void CommandLine(int argc, char** argv);
> > int main(int argc, char** argv) {
> >    CommandLine(argc, argv[]);
> >    ifstream x.open(argv[1], ios:in);
> >    ofstream y.open(argv[1], ios::in);
> >       return 0;
> > };
> > 
> > g++-4 messaging is:
> >>> g++-4 x.cpp
> > x.cpp: In function 'int main(int, char**)':
> > x.cpp:8: error: expected primary-expression before ']'
> token
> > x.cpp:10: error: expected primary-expression before
> ':' token
> > 
> > A recommendation and reason for change is:
> > 1: x.cpp:8 error: illegal to pass an array without
> subscript value as an    argument
> >    The given message is accurate but
> non-expressive of the reason
> >    for failure.
> 
> Actually, in this case I'd say that the original message is
> perfectly fine, and your suggestion is rather confusing.
> However, what one could say here is something like "[] is
> only allowed in declarations".
> 
> 
> > 3: cpp:10 error: illegal scope resolution operator
> ':'
> >    From memory, there are three uses of ':'
> in C++
> >    ':'   label terminator,
> <label>:
> >    ':'   case in a switch
> statement, case <value>:
> >    ':'   scope resolution
> operator, "::"
> >    The given diagnostic message is
> deceptive. 
> 
> Could perhaps say "':' is not a scope resolution operator",
> unless someone comes up with a use case where it is ...
>

^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: messaging
@ 2009-04-15  6:51 Arthur Schwarz
  2009-04-15  6:51 ` messaging Manuel López-Ibáñez
  0 siblings, 1 reply; 9+ messages in thread
From: Arthur Schwarz @ 2009-04-15  6:51 UTC (permalink / raw)
  To: Kai Henningsen, Jonathan Wakely; +Cc: gcc


The issues grow ever more complex. Suppose that we're dealing with macro's, some similarly named, and there's a typo. Suppose  several layers of template expansion are involved and nested deep within one there is some error. Suppose, suppose ... .

The motivation is not to expand the problem domain to the point were even stating the problem is a problem, but to creep up carefully and gradually on some consensus option as to what to do and then to go forward. All the points made are valid. At a certain time either the diagnostic message can not perceive nor report on the original cause of error, or the report is convoluted enough to be unreadable by all but the most diligent.

Let me address some general principles, which, of course, are both mine and may be wrong.
1: The purpose of compiler diagnostics is to present faults to a user
   in the most economic way possible.
2: The presentation should be a pointed as possible as to the detected
   fault.
3: The user should be required to understand as little as possible in
   order to understand the faulting message.

The details of specific messaging are not as important as the guidelines.

What I have seen in this thread and in a companion thread, messages, are these viewpoints.
1: The user should have some minimal capability to understand the 
   diagnostic messages as they are now.
2: The user is being overwhelmed with information and has difficulty
   sifting through it.
3: The messages show the fix but not the problem.

Clearly I am biased to 2: and 3:. But let me turn to 1; for a moment. 

In order to develop software in most languages, C++ being only one, it is not necessary to read nor understand the syntax equations for the language. The notion that developers should be compelled to acquire a knowledge of syntax equations won't work in practice. There is no authority to compell this knowledge nor to deny employment (or hobby work) for someone who doesn't have it. It might be nice but ... . So we are left with compiler users with minimal or none of the assumed pre-requisite knowledge.

The notion that these unknowledgeable users should be abandoned in provided diagnostic messages eventually translates into the compiler being abandoned by the users. In the small, probably fine. In the large I would think it unacceptable.

And there are competitive compilers. Some with better messaging and better messaging resources at the very point where g++ is weakest. You might argue that they are 'better in what way?', but I think the real argument is in what ways can these other products be a model for g++ to improve itself. Unless the notion is that g++ needs no improvement.

A reasoned attitude (I think) is to address each item without prejudice and see if there is some common ground, and then to proceed to see what is possible in general and what edge cases can't be simply solved. 

I think that there is a way to creep upon a general consensus which may not give everyone everything, but will give most something. And I believe the solution is not a 'camel by committee' but a more useable product. 

art

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-04-23  0:42 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-13 22:30 messaging Arthur Schwarz
2009-04-14 13:02 ` messaging Kai Henningsen
2009-04-23  5:50 ` messaging Ian Lance Taylor
2009-04-14 16:58 messaging aschwarz1309
2009-04-14 19:34 ` messaging Kai Henningsen
2009-04-15  3:21   ` messaging Jonathan Wakely
2009-04-14 22:21 ` messaging James Dennett
2009-04-15  6:51 messaging Arthur Schwarz
2009-04-15  6:51 ` messaging Manuel López-Ibáñez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).