c - Is it okay to indicate to a function that modifies(increases or decreases) a value through a flag? -
This is just a design tip that I see. I have a function that is a process before raising or lowering a value. Do I have to get different functions or just one function in the flag and this must be passed to indicate that this value increases or decreases?
i.e.
zero increment_xxx_counter (some RGRs) minus sub_type (some RGR) OR
< Code> zero modified_xxx_counter (some RGR, bull flag) {if (flag) {} else {}}
I will start by looking at the other interfaces used in your application. If there is a similar "modified" function, then I'm ready to match this function in the way that makes sense. Otherwise, if I feel that the function is required, then I can use a one-function approach:
xxx_inc (some * arg, int value); In this way, it is easy to understand what is happening after reading the code. For example:
timer_ic (and, 1); Timer_ic (& amp; t, -1); -or- timer_aut_ic (& amp; t, 1); Timer_a_ic (& amp; t, -1); Instead of less obvious:
timer_modify file (% t, true);
Comments
Post a Comment