Jump to content

Optimizing C++/Guidelines for editors

From Wikibooks, open books for an open world

Conventions

[edit | edit source]

This is the local manual of style (WB:LMOS) for the Optimizing C++ Wikibook.

These conventions are not part of the book, and therefore are to be omitted from the PDF version of the book. They are only directives for contributors (aka editors).

This wikibook, after introductory chapters, contains three sets of programming guidelines:

  • C++ specific guidelines to be applied at design-time or first-implementation-time.
  • Language independent guidelines to be applied in bottlenecks at optimization-time, with examples in C++.
  • C++ specific guidelines to be applied in bottlenecks at optimization-time.

Every guideline has the following format:

  • Mnemonic title. It has a Title 3 style.
  • Rule, having the following style: "When you are in this situation, do this.". It is in bold type.
  • Minimal example of C++ code.
  • Rationale.

The C++ programming style is loosely that used in the books written by Bjarne Stroustrup.

There are no comparisons with other programming languages, except the C language.

Every guideline specifies exactly when it is to be applied, and what the programmer has to do to apply it.

Little reference is done to compiler optimization technology.

Only the most general and useful algorithms are mentioned.

Little reference is done to specific computer architectures, compilers, and operating systems.

The following terms are used:

  • Member function, instead of method.
  • Member variable, instead of instance variable.
  • Function, instead of routine or procedure. The word routine is used only for machine language code.
  • Argument, instead of parameter, for functions declarations, definitions or calls.
  • Parameter, instead of argument, for templates definitions or instantiations.