[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re[2]: [Help-glpk] Suggestions for improvements
From: |
Andrew Makhorin |
Subject: |
Re[2]: [Help-glpk] Suggestions for improvements |
Date: |
Tue, 27 Jul 2004 02:22:22 +0400 |
>> >If the definitions of these constants were changed so that the
>> >compiler sees the symbolic names, then the error messages would be
>> >much more readable and useful. For instance, in my program I do:
>> >#undef LPX_E_OK
>> >const int LPX_E_OK = 200;
>> >after which I get the much better error message:
>> > "Assertion `glp_lpx_simplex( lp ) == LPX_E_OK' failed."
>
><snip>
>
>> This is a common practice. Symbolic constants defined in library headers
>> must not be redefined in the application program.
>
>I agree. That is why I would like the change to be made in the library
>so *I* don't have to do it.
>
>After all, the point of defining macros like LPX_E_OK is to make the
>code readable. It would be nice if assertion failure messages were more
>readable too.
I've misunderstood you. If you write
assert(lpx_simplex(lp) == LPX_E_OK);
and the predicatum is false, the message will be following:
Assertion failed: lpx_simplex(lp) == LPX_E_OK, ...
i.e. just what you need. LPX_E_OK is replaced by a number in other
place, not in the text passed to the assert macro. If you see something
like "Assertion failed: lpx_simplex(lp) == 200, ...", the assert macro
is incorrectly implemented.
Andrew Makhorin