Presuming that your C++ compiler supports them, is there any particular reason not to use __FILE__
, __LINE__
and __FUNCTION__
for logging and debugging purposes?
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.
Basically, can I trust __FILE__
, __LINE__
and __FUNCTION__
to always do the right thing?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…