I have two function foo_good and foo_critically_good. Both the function does conceptually the same thing. Meaning, the code (some fixes in critically_good function) and parameters passed are the same. Only difference is foo_good resides in part of memory that cannot be changed but foo_critically_good can be changed.
We have set of such functions, e.g foo1_good, foo2_good, foo3_good etc. foox_critically_good may not exits at all the time. Whenever we find problem with foox_good, we code foox_critically_good and wherever the code calls foox_good needs to be replaced by foox_critically_good. This case need to handled with individual functions.
Whenever we need critically good, then set the macro to TRUE and build the image again. This solution is compile time solution and this is what we want.Code:Option I Have a macro in header file #define foox_critically_good TRUE or FALSE #ifdef foox_critically_good #define foox foox_critically_good #elseif #define foox foox_good #endif
Is there any better method than this?