Article View: gnu.gcc.help
Article #42441gcc should give a warning
From: liyuan
Date: Sun, 10 Dec 1995 00:00
Date: Sun, 10 Dec 1995 00:00
21 lines
984 bytes
984 bytes
Hi there.
It would be nice if gcc gave a warning for the line `y=X(Y-Z)'
in the following code. This is similar to the `if (x=y)' situation.
Although it not strictly an error for a c++ compiler, it is almost
always an error for a human programmer.
double X(const double x) {return x;}
double Y() {return 1.0;}
double Z() {return 2.0;}
int main()
{
double y;
y=X(1.0+Y); //intended for y=X(1.0+Y()); Error: invalid operands for `-'
y=X(Y-Z); //intended for y=X(Y()-Z()); no warning at all!!!
}
Please email me for responses.
Regards,
Yuan P Li
Technical Details
Message-ID:
<9512101855.AA00054@photone.ak.att.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,ed86e6082e70e37c,start X-Google-Attributes: gid11318c,public From: liyuan@photone.ak.ATt.COM Subject: gcc should give a warning Date: 1995/12/10 Message-ID: <9512101855.AA00054@photone.ak.att.com> X-Deja-AN: 121483980 distribution: gnu sender: daemon@cis.ohio-state.edu organization: GNUs Not Usenet newsgroups: gnu.gcc.help