作者s4300026 (s4300026)
看板C_and_CPP
標題[問題] try catch warning C4101
時間Wed Sep 18 14:37:08 2019
開發平台(Platform): (Ex: Win10, Linux, ...)
win7
編譯器(Ex: GCC, clang, VC++...)+目標環境(跟開發平台不同的話需列出)
vc2010
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
問題(Question):
最近在模仿設計模式的狀態模式
沒權力執行的class會丟出例外
我想要catch掉就好
沒有想要利用該例外物件
因為宣告後沒使用
就跳warning了
餵入的資料(Input):
預期的正確結果(Expected Output):
可以接收指定exception,然後在不做事的情況下
去掉 “未參考的變數區域” 的警告
錯誤結果(Wrong Output):
程式碼(Code):(請善用置底文網頁, 記得排版,禁止使用圖檔)
try{ ... } //do something
catch (exception ^e){ } //do nothing here
補充說明(Supplement):
https://blog.csdn.net/flyingshineangel/article/details/51163727
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 223.137.90.12 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1568788630.A.3DF.html
※ 編輯: s4300026 (223.137.90.12 臺灣), 09/18/2019 15:21:16
推 LPH66: C++17 多了 [[maybe_unused]] 可以貼在參數宣告上 09/19 01:36
→ LPH66: 等等, 你這個是 CLI? 09/19 01:38
→ LPH66: 那可能就沒有這個可以用 09/19 01:39
→ s4300026: 我覺得還是可以試試看,畢竟語法頗像的 09/21 07:34