C ++ CloseHandle()返回之前

时间:2013-12-09 16:53:15

标签: c++

当我在代码末尾使用CloseHandle时,在返回(0)之前,在结束程序时是否也必须调用它,例如在返回(1)之前的if()?

例如:

if(example){
   var = 1
                 // CloseHandle() or not?
   return(1);
}

1 个答案:

答案 0 :(得分:3)

returnexit写在哪里无关紧要;如果它导致程序结束,则应使用CloseHandle 释放资源。

我假设您参考CloseHandle as provided by the Windows API。它不是C ++函数。