This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/36921] comparsion does not have mathematical meaning is not correct
- From: "deba at inf dot elte dot hu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 25 Jul 2008 10:24:04 -0000
- Subject: [Bug c++/36921] comparsion does not have mathematical meaning is not correct
- References: <bug-36921-16097@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from deba at inf dot elte dot hu 2008-07-25 10:24 -------
(In reply to comment #1)
> Example?
>
In the LEMON graph library (http://lemon.cs.elte.hu/) there is an LP solver
interface. The LP constraints could be added like the next formulation:
lp.addRow((double) <= (Lp::Expr) <= (double));
For example:
Lp::Col x1, x2, x3;
lp.addRow(2 <= 2 * x1 + 3 * x2 - 2 * x3 <= 8);
Because the C++ allows overriding every operator, it looks like a good solution
for define range constraints. However, if the -Wparentheses or -Wall is
defined, it emits warnings. For the C language, the warning is a proper
behavior, but the C++ has boolean type, so rather the bool-numeric comparisons
should be warned.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36921