Essential accomplishments for C ++ programmers

Source: Internet
Author: User

I have summarized the "accomplishments" in program writing in the C/C ++ language (mainly the C language). Through these, you can write high-quality programs, at the same time, it will also let people who look at your program be praised, those who have read your program will certainly say: "This person's programming is good ".

01. Copyright and version

02. indent, space, line feed, blank line, and alignment

03. Program comments

04. [in] [out] parameter of the Function

05. Judge the returned results of system calls

06. If statement handling errors

07. # ifndef in the header file

08. allocate memory on the heap

09. Variable Initialization

10. Use of H and C files

11. handling error information

12. Calculation in common functions and loop statements

13. Function Name and variable name

14. function value passing and pointer passing

15. self-cultivation of modifying others' programs

16. Create functions and macros for the same or almost identical code

17. Parentheses in the expression

18. Const in function parameters

19. Number of function parameters

20. function return type. Do not omit

21. Use of the GOTO statement

22. Use of macros

23. Static usage

24. code size in the function

25. Use of typedef

26. Constant enable macro

27. do not define extra points for macros

28. And & statement execution sequence

29. Use for instead of while for loop as much as possible

30. sizeof type instead of Variable

31. Do not ignore warning

32. Program for debugging and release

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.