zoukankan      html  css  js  c++  java
  • Bugslayer's Tips(持续更新中...)

    http://www.wintellect.com/resources/bugslayer/Default.aspx

    Tip #1
    Get rid of the MSDEV splash screen when using Just In Time debugging. First, run REGEDIT and open the key HKEY_LOCAL_MACHINE\Software\Microsoft\ Windows NT\CurrentVersion\AeDebug. Then, change the Debugger key from "\msdev.exe -p %ld -e %ld" to "\msdev.exe -nologo -p %ld -e %ld."

    Source: http://www.microsoft.com/msj/1097/bugslayer.aspx

    如何在JIT调试的时候去掉MSDEV的启动画面。打开注册表键值:HKEY_LOCAL_MACHINE\Software\Microsoft\ Windows NT\CurrentVersion\AeDebug,修改“Debugger”键值为“\msdev.exe -nologo -p %ld -e %ld”。

    Tip #2 Always check CloseHandle's return value. Even though there is not much you can do when CloseHandle returns FALSE, it is generally indicative of a serious problem. Since Win32 will reuse handle values, it is quite easy to accidentally close an open handle being used elsewhere in your code, causing weird random bugs. When you call CloseHandle on a handle that has already been closed, it can sometimes cause random crashes that are impossible to track down. Place all your calls to CloseHandle in VERIFY macros so that you stand a fighting chance of finding those bugs in _DEBUG builds. (Thanks to Jim Austin.)

    Source: http://www.microsoft.com/msj/1097/bugslayer.aspx

    记得检查CloseHandle函数的返回值。即使CloseHandle函数返回FALSE的时候你做不了什么也要检查,FALSE往往意味着出现了一个重大的问题。当你为一个已经关闭的句柄调用CloseHandle函数,可能会出现偶然而且是难以跟踪的崩溃。

    Tip #11 One simple thing I've learned to do is to invalidate that which has been deallocated. For example, if you delete a pointer, set that pointer to NULL immediately afterward. If you close a handle, set that handle to NULL (or INVALID_HANDLE_VALUE) immediately afterward. This is especially true when these are members of a class. By setting a pointer to NULL, you prevent double delete calls. delete NULL is valid. (Thanks to Sam Blackburn, sblackbu@erols.com.)

    Source: http://www.microsoft.com/msj/0898/bugslayer0898.aspx

    在取消内存分配之后马上使它失效,删除一个指针或者关闭一个句柄之后,马上设置为NULL,这样可以避免再次删除所产生的错误,因为删除NULL值是允许的。
  • 相关阅读:
    立体匹配算法(转载)
    校招总结
    tcpip概述
    Matlab2014a 提示未找到支持的编译器或 SDK的解决方法
    CSS3 实现简单轮播图
    css3实现switch开关效果
    Sass的使用和基础语法
    Git的安装和使用记录
    jQuery淡入淡出效果轮播图
    JavaScript焦点轮播图
  • 原文地址:https://www.cnblogs.com/s5689412/p/132168.html
Copyright © 2011-2022 走看看