看板 C_and_CPP 關於我們 聯絡資訊
開發平台(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
jerryh001: VS的話我記得按繼續就會中斷在掛的那一行 11/07 23:45
s4300026: 因為我的程式會給別人使用,如果有漏給ini就不給報錯... 11/08 15:44
hare1039: catch(std::exception e) std::cout << e.what() ? 11/10 01:08