uint64_t build_table ( int32_t myparameter ) { if ( myparameter == 7 ) { return BOOL_TRUE; } else if (myparameter == 29 ) { return BOOL_FALSE; } else { return 23; } return 5; }
Yes, your conversion error is that you have failed to convey what issue you think you are having.
You aren't telling us what is happening. You aren't telling us what you expected should happen. You aren't telling us what input parameters you use. You aren't even letting us see all constants in use in the posted code. Most interesting of all - what condition is expected to return the value 5?
BOOL_TRUE is 1 BOOL_FALSE is 0
when i send 7 i get BOOL_TRUE back when i send 29 i get BOOL_FALSE back when i send 1 or 2 or 3 or 4 or 5 or 6 or 8 or 9 or 10 i get 23 back but when i send "0" i don't get 5 back when i send 11 or 12 or 13 or 14 or 15 or 16 or 17 or 18 i get 23 back
So why should you get 5 back when you send in 0?
Maybe you could explain exactly how you think your program can print the value 5?
uint64_t build_table ( int32_t myparameter ) { if (myparameter == 7) { return BOOL_TRUE; } else if (myparameter == 29) { return BOOL_FALSE; } else { return 23; <== exactly why shouldn't input 0 reach this line? } return 5; <== exactly how do you expect your program to reach this line? }
Exactly why do you think 0 is magical and should ignore the "return 23" statement?
View all questions in Keil forum