Compilation at the high warning level cleanly

Source: Internet
Author: User

 

Although the warning does not affect the running of your code, do not ignore it.

 

Use the compiler as your friend. If it gives you a warning, it often shows that your code has potential problems.

 

Common Warnings:

 

1. Third-party header files.

 

2. Unused function parameters.

 

3. defines variables that have never been used.

 

4. variables may not have been initialized before they are used.

 

5. The return statement is missing.

 

6. The number of signed or unsigned characters does not match.

 

Exceptions:

 

Sometimes, the compiler may generate annoying or even false warnings, but it does not provide a solution. In this case, it is too busy to modify the code to solve this warning. In this rare case, as a team decision, avoid useless warnings that are purely useless: disable this warning separately, but disable it locally as much as possible, and write a clear comment to explain why it is necessary to disable it.

 

C Xiaojia

Related Article

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.