Mail Archives: djgpp/1997/02/03/07:02:07
r. v. paasen wrote:
>
> 2) gcc produces a warning (NOT related to 1) that I don't understand:
> 'control reaches end of non-void function `Matrix::operator ()(int,
> int) const'
[snip]
> matrix.hpp: In method `double & Matrix::operator ()(int, int) const':
> In file included from geometry.hpp:8,
> from matrix.cpp:8:
> matrix.hpp:87: warning:
> control reaches end of non-void function `Matrix::operator ()(int,
> int) const'
>
> ----------------
> THIS IS THE INLINE FUNCTION IN HEADER FILE matrix.cpp GCC COMPLAINS
> ABOUT:
>
> float& operator()(int r, int c) const
> {
> #ifdef RANGECHECK
> if (!matrix) fail("Trying to index a non-matrix"); // matrix is an
> array
For an exact answer you should tell us at least where line 87 is, but I
think
it is the above line. In this line gcc sees that if the condition
'(!matrix)' is true the operator does not return a value.
Probably the function 'fail(...)' does not return, but gcc does not know
this. To tell gcc, that the function 'fail' does not return you should
declare it with the 'noreturn' attribute:
void __attribute__((noreturn)) fail(char *);
Robert
--
*****************************************************************
* Robert Hoehne, Fakultaet fuer Mathematik, TU-Chemnitz-Zwickau *
* Post: Am Berg 3, D-09573 Dittmannsdorf *
* e-Mail: Robert DOT Hoehne AT Mathematik DOT TU-Chemnitz DOT DE *
* WWW: http://www.tu-chemnitz.de/~rho *
*****************************************************************
- Raw text -