c/2776: Wrong (misleading) error message in gcc 2.95.3
Wolfgang Bangerth
bangerth@ticam.utexas.edu
Wed Feb 19 16:57:00 GMT 2003
> I apologize if I was wasting your precious timewith this as it now seems
> not so important issue, but I wasted so much time resolving it that I
> thought it was important to be resolved, or at least known issue.
>
> Thank you for your time. Mirsad
No problem. This is just one of the cases where what you wanted would
require the compiler to second-guess what was your original intention.
Your example boiled down to
char *p = hip hop step;
The problem was the missing quotes (which the compiler can't know, since
the three tokens came from the preprocessor, and there might be many
possible interpretations of what the orginal intent was:
char *p = "hip hop step";
char *p = hip+hop+step; // hip=char*, hop,step=int
char *p = hiphopstep; // hiphopstep=char*
etc. There is just not something sensible the compiler can say here,
except for "parse error" or so.
With respect to the fact that the error message was totally
incomprehensible: most experienced programmers know that if something is
_really_ incomprehensible, the look at the preprocessed sources. I'd say
this is for exactly the same kind of experience you just made :-(
W.
-------------------------------------------------------------------------
Wolfgang Bangerth email: bangerth@ticam.utexas.edu
www: http://www.ticam.utexas.edu/~bangerth/
More information about the Gcc-bugs
mailing list