Suppose we have application on Linux, pure C. Application consists of several functions - f1
, f2
and f3
, which receive a structure. One element of the structure is debug_mode
, with values ON
or OFF
.
How can I switch debug mode in f1
, f2
and f3
(for example, some printf
s) when the structure has debug_mode == ON
?
Should I always use if
statements to check debug_mode
for every incoming structure or there is some another best practise to not use always if
statements?
For example, these could be traces in telecom products, where we could collect some trace data for a specified subscriber.