Advance knowledge of software development (6): Program layout and annotations

Source: Internet
Author: User

The 1th part of the new understanding of C language

Layout and annotations of programs

In the "High Quality Programming Guide (c + + language)", the author said: The program can be likened to the layout of "calligraphy", good "calligraphy" can make people on the program at a glance, look cheerful. Indeed, when we open the program, the first thing we see is the layout of the program, our first impression is that the program is written neatly or messy. Said first impression is very important, in order to give everyone a good first impression, we must pay attention to the layout of the program.

In addition, good annotations can help readers understand the process more quickly and improve the efficiency of the work. Perhaps because of the busy work, many software engineers do not like to write notes for their own programs, that is not necessary to do so. So how would he feel if he gave him a code without any comment? In the program, graceful, proper annotation can play the role of icing on the cake, more can reflect the professional quality of an engineer. Therefore, it is necessary to write a note.

In the C language Program, the header file (. h file) and the implementation file (. c files) are generally included, and their layout and comments are as follows:

First, the layout and annotation of the header file.

The header file plays an auxiliary role, briefly reflecting the basic functions of the program.

In general, the layout of a header file can take the following style:

/***************************************************************

* Copyright (C) 2014, company name.

*

* File name:

* Content Summary:

* Other Description:

* Current Version:

Author

* Date of Completion:

*

* Modify the Record 1://Modify history, including modification date, version number, modification person and modification content, etc.

* Date Modified:

* Version number:

* Modified Person:

* Modify Content:

***************************************************************/

#ifndef _xxx_h//Prevent header files from being repeatedly referenced

#define _xxx_h

/**************************************************************

Related macro Definitions

**************************************************************/

/**************************************************************

Related structure body definition

**************************************************************/

/**************************************************************

Declaration of functions appearing in this program

**************************************************************/

#endif

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.