lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi] testing e_yes_or_no values


From: Vadim Zeitlin
Subject: [lmi] testing e_yes_or_no values
Date: Sat, 12 Jul 2008 19:34:29 +0200

 Hello,

 Are the values of e_yes_or_no type supposed to be handled as boolean
values? IOW what is the correct way to test for their truthfulness? Is

        e_yes_or_no value;
        if ( value )
                ...

acceptable or should it be

        if ( value == e_yes )
                ...

?

 I'm asking this because the current code in inputs.cpp does

        if ( value == true )
                ...

and this just doesn't seem right to me (and incidentally provokes an MSVC
warning about comparing int with bool). If you agree, could you please
apply

--- inputs.cpp  2008-07-02 13:12:21 +0000
+++ inputs.cpp  2008-07-12 17:31:13 +0000
@@ -893,7 +893,7 @@
     bool need_loan_rates =
             e_solve_loan         == SolveType
         ||  e_solve_wd_then_loan == SolveType
-        ||  true                 == WDToBasisThenLoan
+        ||  e_yes                == WDToBasisThenLoan
         ||  0.0                  != InforceAVRegLn
         ||  0.0                  != InforceAVPrfLn
         ||  0.0                  != InforceRegLnBal

? And in any case I'd like to know what is the preferred way to do it.

 Thanks,
VZ





reply via email to

[Prev in Thread] Current Thread [Next in Thread]