delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/02/17:04:30

From: "r. v. paasen" <R DOT L DOT F DOT v DOT Paasen AT stud DOT tue DOT nl>
Newsgroups: comp.os.msdos.djgpp
Subject: gcc problem
Date: Sun, 02 Feb 1997 21:57:47 +0100
Organization: Eindhoven University of Technology, The Netherlands
Lines: 63
Message-ID: <32F4FFCB.6D80@stud.tue.nl>
Reply-To: R DOT L DOT F DOT v DOT Paasen AT stud DOT tue DOT nl
NNTP-Posting-Host: annex1s10.urc.tue.nl
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hi,

I have 2 questions about gcc.

1)   When optimizing with -O3, gcc doesn't respond with some files. The
files
     are not extremely large. gcc works fine with files of 900 lines.
With some
     files, (300 lines) gcc locks up. 300 lines is less than 900, so gcc
should
     definitely not run out of memory compiling 300 lines, if it can
compile
     900 lines. What could be the problem?

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'
     I included the info for this warning at the end of this message.
     Could someone explain what the warning means, and how it can be
resolved?


Richard.

----------------
THIS IS THE COMMANDLINE:

  gcc -Wall -I. -c matrix.cpp


----------------
THIS IS THE OUTPUT FROM GCC (1 WARNING)

  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
      else
        if (r<0 || r>=rows || c<0 || c>=cols) fail("Trying to index
matrix out of range");
        else
    #endif
      return matrix[r*cols+c]; // this is line 87 with the warning
  }

-- 
-------------------------------------------
email: <mailto:R DOT L DOT F DOT v DOT Paasen AT stud DOT tue DOT nl>
www:   <http://huizen.dds.nl/~buddha/>
SENDING UNSOLICITED MAIL AND JUNK MAIL IS PROHIBITED

- Raw text -


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