[問題] 當程式因throw而死時能知道exception嗎?
開發平台(Platform): (Ex: Win10, Linux, ...)
win10
編譯器(Ex: GCC, clang, VC++...)+目標環境(跟開發平台不同的話需列出)
VC++
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
exception
問題(Question):
如題。 當C# throw 時,會有additional information 輔助除錯
會將 exception.ToString();
但是C++發生throw時,要怎麼做到這件事情呢?
餵入的資料(Input):
throw;
預期的正確結果(Expected Output):
https://imgur.com/H10oKg2
![](https://i.imgur.com/H10oKg2.jpg)
![](https://i.imgur.com/7YDJ2ZP.jpg)
程式碼(Code):(請善用置底文網頁, 記得排版,禁止使用圖檔)
C++:throw std::exception("Hello World!");
C#:throw new Exception("Hello World!");
補充說明(Supplement):
如果沒有辦法的話,想問大家是怎麼處理發生問題時,
沒接到問題造成程式死掉的bug。 應該說有建議的方法嗎?
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 60.250.235.221
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1541591770.A.26E.html
※ 編輯: s4300026 (42.72.99.92), 11/07/2018 20:14:09
→
11/07 23:45,
5年前
, 1F
11/07 23:45, 1F
→
11/08 15:44,
5年前
, 2F
11/08 15:44, 2F
推
11/10 01:08,
5年前
, 3F
11/10 01:08, 3F