title: Is there an automatic way to remove debugging methods for a release build?
body: <p>Note: This is an extension of an earlier question I asked here: <a href="https://stackoverflow.com/questions/4447008/do-additional-function-method-definitions-increase-a-programs-memory-footprint/">Do additional function/method definitions increase a program&#39;s memory footprint?</a></p>
  
  <p>When I write a class, I usually end up writing several testing/debugging methods, used to make sure the class works as it should, or for printing data to help with debugging, or for unit testing, etc. Is there an easy/automatic way to make a release without these methods, or do I need to manually delete the extra code any time I want to compile a release version?</p>
  
  <p>I ask this question both from a C++ and a Java perspective. I'm using Code::Blocks and Eclipse as IDEs, if that plays into the answer somehow.</p>