Skip to content

Latest commit

 

History

History
51 lines (37 loc) · 1.74 KB

modern-modern-cpp.md

File metadata and controls

51 lines (37 loc) · 1.74 KB

Modern modern C++

Core question from Christian: With all the new features with every new generation, is there a "common" (idiomatic) way of writing code with the new(est) construct.

Examples:

  • Instead of "hard" cast (int)value do a specific cast like static_cast<int>(value)
  • Instead of "oldscool" function definition int main() {} do a auto main() -> int {}

Resources

Findings

Agreement: We're less concerned about subjective things like naming guidelines or similar styling issues.

For GCC-based compiler: not just use -Wall - use -Wall -Wextra. And use -Werror for good measure.

Regarding annotations: If there is nothing that "enforces" them, it may lead to undefined behaviour. Such enforcing is also necessary for a group-based development. With such enforced checks, wanted style is better followed by more than one (more motivated) person. Refer to linters & core guidelines in the resources list above.