30-04-2018, 06:23 AM
You may have to write your code differently and less complex.
1. The first IF doesn't perform a real test. Actually you're only test that the variable is not empty, instead of "== true/false/on/off/etc .
2. For the second IF, you know that the compiler will generate/use temporary variables/registers to store temporary test results.
My opinion is: Do it yourself :). Create local variables to store your checks.
Small tasks are easier to read/maintain/debug/optimize ^^
One example:
You're comparing return of a function with the result of a test.
i assume that the result of the function, even if you define a boolean type, is not the same type of the "==" test result...
1. The first IF doesn't perform a real test. Actually you're only test that the variable is not empty, instead of "== true/false/on/off/etc .
2. For the second IF, you know that the compiler will generate/use temporary variables/registers to store temporary test results.
My opinion is: Do it yourself :). Create local variables to store your checks.
Small tasks are easier to read/maintain/debug/optimize ^^
One example:
Code:
..(vF_mcms_fl_on((tm_uint8)V_FLONCMD_ACK)) || (msg_info.pmcu_state == LDF_MASSSQC_STATE_ACTIVE)...
You're comparing return of a function with the result of a test.
i assume that the result of the function, even if you define a boolean type, is not the same type of the "==" test result...
<t></t>