title: __FILE__, __LINE__, and __FUNCTION__ usage in C++
body: <p>Presuming that your C++ compiler supports them, is there any particular reason <em>not</em> to use <code>__FILE__</code>, <code>__LINE__</code> and <code>__FUNCTION__</code> for logging and debugging purposes?</p>
  
  <p>I'm primarily concerned with giving the user misleading data—for example, reporting the incorrect line number or function as a result of optimization—or taking a performance hit as a result.</p>
  
  <p>Basically, can I trust <code>__FILE__</code>, <code>__LINE__</code> and <code>__FUNCTION__</code> to <em>always</em> do the right thing?</p>