[問題] 當程式因throw而死時能知道exception嗎?

看板C_and_CPP作者 (s4300026)時間5年前 (2018/11/07 19:56), 5年前編輯推噓1(102)
留言3則, 3人參與, 5年前最新討論串1/1
開發平台(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
錯誤結果(Wrong Output): https://imgur.com/7YDJ2ZP
程式碼(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
VS的話我記得按繼續就會中斷在掛的那一行
11/07 23:45, 1F

11/08 15:44, 5年前 , 2F
因為我的程式會給別人使用,如果有漏給ini就不給報錯...
11/08 15:44, 2F

11/10 01:08, 5年前 , 3F
catch(std::exception e) std::cout << e.what() ?
11/10 01:08, 3F
文章代碼(AID): #1RujBQ9k (C_and_CPP)