title: Keeping logging/debugging info without runtime penalty
body: <p>I have this C code that implements an algorithm in the context of computer science research. The mentioned code contains many <code>printf</code> and other functions calls that output formatted information about the state of the algorithm and key values in particular points. This output is very useful/clear from a learning perspective.</p>
  <p>I would like to somehow preserve and access this information if desired, but not hurting the performance if I don't want such information.</p>
  <p>I thought about some <code>DEBUG</code> macro definition, and injected a bunch of <code>ifdef</code>s:</p>
  <pre><code>#define DEBUG
  ...
  #ifdef DEBUG
      printf(&quot;At this point...&quot;);
  #endif
  </code></pre>
  <p>But this makes the code ugly and difficult to read.</p>
  <p>I am using Git, so perhaps some sort of alternate version could be a better approach to access the &quot;learning&quot; or &quot;clean&quot; version of the code.</p>
  <p>So my concrete questions are related with practicality and coding conventions:</p>
  <ol>
  <li>Is there a practical way to accomplish this?</li>
  <li>Is this just a flat out bad practice, and I shouldn't keep code doing this sort of thing?</li>
  </ol>