__FILE__、__LINE__ 和 __FUNCTION__ 在 C++ 中的用法 - __FILE__, __LINE__, and __FUNCTION__ usage in C++

問題:

Presuming that your C++ compiler supports them, is there any particular reason not to use __FILE__ , __LINE__ and __FUNCTION__ for logging and debugging purposes?假設您的 C++ 編譯器支持它們,是否有任何特殊原因使用__FILE____LINE____FUNCTION__進行日誌記錄和調試?

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?基本上,我可以相信__FILE____LINE____FUNCTION__總是做正確的事嗎?


解決方案:

參考一: https://en.stackoom.com/question/2VKI
參考二: https://stackoom.com/question/2VKI
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章