c++ hard to find bug of interesting

  • 2020-05-30 20:49:59
  • OfStack

These bug can give you a pitcher of water.

1. The code contained in the assertion (assert)

It often happens when you switch to the release version, and the result is a good one. The end result is that the code in assert parentheses is not executed under release.

Discovery: trace, unable to execute code

2. Object member data is out of order

Basically, the other members above the member memory were deleted out of bounds. class foo {int arr [2]. int val; } if arr[2]=3; So the value of val is going to change.

Discovery: memory breakpoint

3. Memory leak

The memory is off the rein.

Find: # include "crtdbg.h" and reload new, refer to Microsoft documentation. Support for the windows platform is recommended under linux to take advantage of powerful development tools.


Above is this site to introduce you c++ difficult to find bug(interesting), I hope to help you, if you have any questions welcome to leave me a message, this site will timely reply to you!

Related articles: