A few words translated by yourself

Source: Internet
Author: User

  1. Objective object
    1. The original developers and other developers who use the code should make the code easy to understand.
    2. Initially, developers and other developers should easily include some code and keep the Code consistent throughout the lifecycle.
    3. Make the code easy to classify.
  2. Class Name
    1. The general class should start with C, such as cvideofile
    2. Useful classes that only contain static members should start with U. For example, ustringutils
    3. Some declared stack classes are constructed and reconstructed using their own constructor and destructor. They should start with St, such as stwaitcursor.
    4. Each class is in a. cpp file and A. H file. Each file should contain only one class. The file name should be class name. cpp and class name. h. Do not omit the prefix C, U, or St.
    5. The file should be scoped

# Ifndef _H_ Classname _

# DEFINE _ h_classname _


# Endif

  1. Function Name function name
    1. The function name should be a complete word, not a thumbnail.
    2. Each word in the function name should be a capital letter.
    3. The function name should be descriptive.
  2. Parameters
    1. Each parameter should use a prefix to indicate whether the parameter is an input value, an output value, or both.

I. Use "in" to indicate that this parameter is an input value.

Ii. Use "out" to indicate that this parameter is an input value.

Iii. Use "Io" to indicate that this parameter is the input value. Use "Io" to indicate it is both input and output.

    1. You do not need to use a prefix to indicate the data type.
    2. The parameter name after the prefix should be a complete word, not a thumbnail
    3. Each word must start with an uppercase letter.
    4. Each parameter must have a unique meaning.
  1. Return Value
    1. The returned value must have a unique meaning.
    2. If multiple return values are required, use the pointer or the parameter "out" as the prefix.
    3. Use the enumeration type as the return value. These return values are flags)
    4. If the meaning of a return value is not obvious, the return value must be defined in the. h file.
  2. Function body
    1. Module start and end ("{" and "}") should be a single line
    2. The module end should be vertical to the Start match
    3. Generally, a function contains less than 7 lines of code.
    4. A function should not exceed the visible field of VC (the complete function must be visible in a VC environment without a scroll bar)
    5. Local variables should be described before they are used (the later the better) (declared)
    6. Partial variables should be complete words, not Acronyms
    7. The first word of the local variable name should start with a lowercase letter, and other words of the variable name should start with an uppercase letter. For example, "newcolor ".
  3. Project
    1. (Library projects) The Library project should have a name starting with "engine"
    2. Projects that contain internal data logic should start with "data ".
    3. The project containing the user interface code should start with "View ".
    4. The created .exe project should start with "app ".
    5. Resource projects that contain language resources should start with "language ".
    6. The project for creating the filter should start with "filter ".
    7. The application project should contain as few code as possible
  4. Text Format
    1. Use the standard VC default environment as the code editor format
    2. Do not use the third-party code editor to avoid different appearances on different PCs (look)
    3. The Code width should be limited to the VC code compiler window without a horizontal scroll bar
    4. The vertical length of each function should be limited to the VC code window without the vertical scroll bar.
  5. Code
    1. Do not use the "Goto". Statement
    2. Do not use the "return", "break", or "continue" statements in the middle of the loop. These statements make the code header hard to understand and are prone to errors.
    3. In "if... Else ..." Do not use the "return" statement unless "if... Else ..." No other code after the module
  6. Assembly set
    1. Assembly Code shocould use MS aggreger. The collection code should use the MS collection
    2. Assembly Code shoshould be accompanied by corresponding C code. The collection code should be used with the corresponding code

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.