This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: funny syntactical error message
- To: rlau at csc dot com
- Subject: Re: funny syntactical error message
- From: Mo McKinlay <mmckinlay at labs dot interopen dot org>
- Date: Wed, 8 Mar 2000 18:40:58 +0000 (GMT)
- cc: gcc at gcc dot gnu dot org, Ulrich dot Lauther at mchp dot siemens dot de
# In the inline function access, are you trying to return a specific element of
# bar[] ? If so, your syntax might be the source of the problem.
# Try
# return bar[i];
This is certainly a way to prevent the error message from appearing -
however, IMHO, the error that g++ produces in this case is misleading. It
may be technically correct, but displaying an offset to this instead of a
member name isn't exactly a user-friendly tactic to use when issuing
errors.
[I think, incidentally, that this was the intent of the original message]
Consider:
foo.c:7: 'this + 40' cannot be used as a function
and:
foo.c:7: 'bar' cannot be used as a function
In the example given in previous messages, the source of the error is
clear in both cases. However, consider a statement which accesses several
members of a class. If the offset to 'this' is given, the programmer must
scan the line for each member and check if the synatax is correct (I
believe that this error would in most cases be caused by a typographical
error). However, if the member name is given, the programmer can easily
pinpoint the source of the error.
--
Mo McKinlay T: +44 (0) 709 22 55 05 x1
Chief Software Architect F: +44 (0) 709 22 55 05 x3
inter/open E: mmckinlay@labs.interopen.org
A division of Bekon Marketing Limited W: http://www.interopen.org