This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
value computed is not used
- To: egcs at cygnus dot com
- Subject: value computed is not used
- From: Shigeya Suzuki <shigeya at foretune dot co dot jp>
- Date: Mon, 20 Apr 1998 17:34:04 +0900
Since I built first egcs last year, I'm getting following warning if I
use -Wall:
value computed is not used.
Actually, the value is computed and used.
Following snippet demonstrates this:
------------------------------
class Cx {
private:
int m_v;
public:
Cx() : m_v(0) { };
void set(int z) { m_v = z; }
int eval(void) { return m_v; }
};
class Cy {
private:
Cx* m_x1;
Cx* m_x2;
Cx* m_x3;
public:
Cy() : m_x1(0), m_x2(0), m_x3(0) { };
void setx1(Cx* v) { m_x1 = v; }
void setx2(Cx* v) { m_x1 = v; }
void setx3(Cx* v) { m_x1 = v; }
void exec() {
for (m_x1 != 0 && m_x1->eval();
m_x2 != 0 && m_x2->eval();
m_x3 != 0 && m_x3->eval()) {
}
}
};
------------------------------
dream 18% g++ -Wall -c z.cpp
z.cpp: In method `void Cy::exec()':
z.cpp:25: warning: value computed is not used
z.cpp:28: warning: value computed is not used
------------------------------
Why this happen?
Shigeya Suzuki shigeya@foretune.co.jp