Bugslayer's tips (continuously updating ...)

Source: Internet
Author: User
Http://www.wintellect.com/resources/bugslayer/Default.aspx

Tip #1Get 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 "" \ Msdev.exe-nologo-P % LD-E % lD ."

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

How to remove the msdev startup screen during JIT debugging. Open the registry key: HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows NT \ CurrentVersion \ AeDebug, and change "Debugger" to "\ msdev.exe-nologo-P % LD-E % lD ".

Tip #2Always 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 callto 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

Check the return value of the closehandle function. Even if the closehandle function returns false, you need to check if you cannot do anything. False often means a major problem. When you call the closehandle function for a closed handle, an unexpected and untraceable crash may occur.

Tip #11One 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 CILS. delete null is valid. (thanks to Sam Blackburn, sblackbu@erols.com .)

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

It will expire immediately after memory allocation is canceled. After a pointer is deleted or a handle is closed, it will be set to null immediately, so as to avoid the error caused by re-deletion, it is allowed to delete null values.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.