www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/03/07:02:07

From: Robert Hoehne <Robert DOT Hoehne AT Mathematik DOT tu-chemnitz DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: gcc problem
Date: Mon, 03 Feb 1997 11:57:49 +0100
Organization: TU Chemnitz-Zwickau
Lines: 43
Message-ID: <32F5C4AD.2CAF@Mathematik.tu-chemnitz.de>
References: <32F4FFCB DOT 6D80 AT stud DOT tue DOT nl>
NNTP-Posting-Host: cancel.hrz.tu-chemnitz.de
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019