About Google's C + + coding style

Source: Internet
Author: User

We all know that there are many open source projects in Google, but I have looked at some open source projects and feel that the code quality is the best. Behind these "dogma" rules is the rational thinking that comes from the accumulation of perennial engineering experience.

Why good? The main points are as follows:

1. Specification, just like a person writes out.
2. Abstract but not overly abstract.
3. Algorithm implementation will not obscure, need to have trade off the skill.

Google's set of C + + Style Guide has a direct impact on many open source projects. It also has a unique parameter specification: input with a reference, output with a pointer, input parameters must be before the output parameters, even if the new. What the logic of this specification is. There is no point in understanding and reciting specifications, and we need to understand the logic behind the specification and then incorporate it into the design process. There is no answer to this small question, but at least there are several things to analyze:
-Parameter write inverse can be found from static check/compile time
-Read the code without looking at the function declaration for I/O at a glance

The above is still a high degree of readability, but also can quickly locate the issue of compile time.

Of course, it is difficult and unnecessary to consider these details in actual team development, but it is possible to understand the tastes and logic of a person. The quality of the code is really not particularly related to the success or failure of the product and the company, but as an engineer, we should pursue our own things from our own point of view. Ah, it's art.

Google has customized the specifications of many programming languages: (Chinese version below)

http://zh-google-styleguide.readthedocs.org/en/latest/

About Google's C + + coding style

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.