close

 

 

   

//2020/8/3
//如果函式或方法確認不會拋出例外,可以使用 noexcept 指明
//使用時機:
//1.我們確保函數不會拋出異常
//2.我們不知道該如何處理異常(發生時,就直接terminate)
//C++11: Specifies whether a function might throw exceptions.
int add(int a, int b) noexcept
{
    return a + b;
}
 
image  

 

arrow
arrow
    全站熱搜

    天才R 發表在 痞客邦 留言(0) 人氣()