C ++ interesting and hard-to-find bugs

Source: Internet
Author: User

C ++ interesting and hard-to-find bugs

You can drink a pot of these bugs.

 

1. assert code

The execution result is good when you switch to the release version. The final search result is that the Code in assert brackets is not executed under release.

Discovery: trace, no code executed

2. The object member data is out of order.

It is basically because the other members in the member memory are out of bounds when they are deleted. Class foo {int arr [2]; int val;} in this case, if arr [2] = 3; then the val value will be changed.

Found: Memory breakpoint

3. Memory leakage

These memories break away from the reins.

Found: # include "crtdbg. h" and reload new. Refer to Microsoft documentation. In linux, we recommend that you support the windows platform and use powerful development tools.

 

Continuous supplements

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.