Statistics on bug types

Source: Internet
Author: User
1. in the while and for loops, We must persistently continue the code that must not be executed. (today, this bug is because of my weakness when I first wrote code, the redundant data is not resolutely filtered out. As a result, the redundant data enters the system, causing an inexplicable bug. Therefore, we must resolutely remove the redundant data we have determined)
The original code is in the For Loop
If (CY <0 ){
Cy = 0;
}
As a result, Cy = 0, that is, the data in the first row is always incorrect. The data in CY <0 is washed out;
Change to If (CY <0) {continue;} and everything is OK.
2. Improper use of the Return Statement.
If (! OK ){
Return;
}
I think this writing is cool.
The results are often found to be troublesome due to return in advance. Therefore, try to be as simple as possible. Do not pursue a weird programming style...
3. >,< and >=, <=
There have been countless times in the hands of the equal sign. Many times, if the brain is not awake when writing code, it will not be enough to filter out whether or not the boundary is included. As a result, a problem occurs in the basic library, the following boundary bug is hard to come across and can be easily ignored. It often needs to be repeated many times before it can be reproduced. This bug is the most terrible !!
In the future, when encountering such a bug that is hard to reproduce, we need to consider special boundary situations.

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.