i want to use inline function like in c++ language. how to do in keil c or it's not support? use #define to simulate ?
However, some of the optimisation options in v6.14 might help? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Sorry, I dont know what you mean. Do you mean that the compiler will let functions that be called only once become inline functions automatically? if yes, how to set this option?
I don't think it goes that far, but look at Level 8, Common-Tail Merging, and Level 9, Common-Block Subroutine Packing. Note that enabling an optimisation level automatically includes all the lower levels. (I presume your emphasis would be "Favour Code Size?") If your function is only ever called once, does it really need to be a function? A function might be better for "style," but optimisation seems to be your overriding concern? In this case, it's OK to sacrifice "style" so long as it's well justified and all clearly documented
Thanks for your answer. My point is readable code. for example: switch x { case 1: f1(); case 2: f2(); ..... it's more clear than not using function. but i'm afraid to call too much level, the stack memory overflow. especially in interrupt function. Maybe I should try another programming style.