3 回答

TA貢獻(xiàn)1789條經(jīng)驗(yàn) 獲得超8個贊
#pragma warning( push )
#pragma warning( disable : 4101)
// Your function
#pragma warning( pop )

TA貢獻(xiàn)1815條經(jīng)驗(yàn) 獲得超13個贊
如果只想在一行代碼中禁止顯示警告,則可以使用suppress 警告說明符:
#pragma warning(suppress: 4101)
// here goes your single line of code where the warning occurs
對于單行代碼,其工作原理與編寫以下代碼相同:
#pragma warning(push)
#pragma warning(disable: 4101)
// here goes your code where the warning occurs
#pragma warning(pop)

TA貢獻(xiàn)1874條經(jīng)驗(yàn) 獲得超12個贊
#pragma push / pop通常是解決此類問題的方法,但是在這種情況下,為什么不刪除未引用的變量呢?
try
{
// ...
}
catch(const your_exception_type &) // type specified but no variable declared
{
// ...
}
- 3 回答
- 0 關(guān)注
- 492 瀏覽
添加回答
舉報