摘要:
打开/创建一个HANDLE而忘记close的情况时有发生。利用RAII的思想,将HANDLE封装为一个类,在其析构函数中进行close,是一个不错 的方法。 ATL提供了一个CHandle类,但是提出了以下使用注意事项: Some API functions will use NULL as an empty or invalid handle, while others use INVAL... 阅读全文
摘要:
1. 本来,MSDN已经明确指出了: You can call _endthread or _endthreadex explicitly to terminate a thread; however, _endthread or _endthreadex is called automatically when the thread returns from the routine pas... 阅读全文
摘要:
节选:http://stackoverflow.com/questions/2331316/what-is-stack-unwinding 1. Stack unwinding is usually talked about in connection with exception handling. Here's an example: void func( int x ){ char... 阅读全文