C + + believer's Moses 10 ring

Source: Internet
Author: User
Tags doxygen

This is the C + + believer's Moses 10 precepts, although the Ten Commandments, in fact there are 14, but these 14 are worth engraved on the edge of the display for C + + programmers to worship every day. I will engrave it in my blog, engraved in my memory, until they become part of my mind.

No. 0: Don't stick to the details (understand what should not be standardized)

Indent: Do not have to specify how to indent, each person to follow a favorite rule.

• President: Today there is no much need to limit the 80 characters, of course, the more conducive to reading the better.

• Naming: Don't be too harsh, except that macros should all be capitalized, as long as you follow some kind of acceptable style. There are 2 common styles, one is the hyphen connection all lowercase words, the other is the word first letter capitalization. If you need to use a variety of third-party libraries, it is almost impossible to maintain a style. Consistent within a certain range, the goal is to make reading easier.

• Note: Do not specify the format of the annotation. However, it's a good idea to use annotations with Doxygen syntax, and I've been using Doxygen to produce documents.

• Hungarian notation: I am glad that I have found an ally who supports me for what I dislike. Using a little trick to express a type in the C + + language is unhelpful, and C + + doesn't need it at all, it only leads to chaos.

• Single-entry single export: in the C + + world, which supports exceptions and deterministic deconstruction, this is superfluous.

Here, there is a clear-cut objection to two things: the Hungarian notation and the principle of single entry.

1th: Cleanly compile at high warning level

Turn the compiler's warning level up to maximum and silently generate results. For a man who sees the warning as nothing, close the door! Put the dog! Also, do not easily turn off compiler warnings in the source code.

• For Third-party libraries, block around the included files.

• Parameter not used: This parameter name is not provided.

• Unused variable: You can insert an expression for that variable. This is an idiomatic method, it will be more used.

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.