
On the morning of September 21, at the opening CppCon report, Björn Straustrup
officially announced the C ++ Core Guidelines [
link to the GitHub project ] [
link to the slides ] - the start of a new open source-project to develop modern authoritative guidelines for C ++ code writing. Guidelines are designed to be up-to-date, machine-verifiable, and also open for use by third-party companies — such that any interested organization can take them and incorporate them into their own corporate coding standards.
The authors of the project were Bjorn Straustrup and Herb Sutter; guidelines were created with the participation of experts from CERN, Microsoft, Morgan Stanley and several other organizations. Now the guidelines have reached version 0.6, and Stroustrup encourages everyone to actively contribute to the project.
')
Stroustrup in his speech said the following: “You can write C ++ programs that will be statically type-safe and in which there will be no resource leaks. You can do this without loss of performance and without limiting the expressive power of C ++. All of this serves to support the basic thesis that garbage collection is not both necessary and sufficient part of high-quality software (
garbage collection ). Our new guidelines make writing code simpler than it was in the old C ++ programming styles, and its security can be tested with tools that will soon be available in open source. ”
In general, the rules in guidelines are more prescriptive than prohibition, and relate to a much wider range of topics than code design standards.
Despite the fact that the repository was officially announced only on Monday, it was opened publicly at the end of last week, and was # 1 in GitHub trends on Friday and last week.
In addition to the main announcement of the guidelines, Straustrup also announced two related projects:
- Guideline Support Library (GSL) : The C ++ Core Guidelines defines a small GSL library, which is a collection of commonly used types like array_view and not_null, which should facilitate the transition to the guidelines. The starting implementation is laid out in the open source Microsoft on Github in the GSL repository . It is written in portable C ++, which should work on any modern compiler and platform, and has been tested on Clang / LLVM 3.6 and GCC 5.1 under Linux, with Xcode and GCC 5.2.0 under OS X, and Microsoft Visual C ++ 2013 (Update 5) and 2015 under Windows. This implementation will be supported, and its source code will continue to remain open; The emergence of alternative implementations from other vendors for their compilers / analyzers is welcomed.
- Checker tool : C ++ Core Guidelines are designed to be as machine-verifiable as possible, so most of the rules can be verified by a compiler, static analyzer, or other tool. The initial implementation based on Microsoft Visual Studio will be demonstrated this week at the conference, and will be available as an executable under Windows in October, with the intention of opening the source code later. This tool will also be supported, and its source code will continue to remain open; The emergence of alternative implementations from other vendors for their compilers / analyzers is welcomed.
This step was to be expected, since Bjorn repeatedly pointed out the lack of the lack of such a modern manual in his annual presentation
What - if anything - have we learned from C ++? . The attempt to unify the used set of language tools is due to the fact that now several people within the same team can use different C ++ subsets, resulting in misunderstanding between them (and companies like Google are
not an exception in this regard).
Some of the reports at CppCon will take a closer look at the topics related to guidelines - there will be speakers who will take part in their creation:
- Herb Sutter: Writing Good C ++ 14 by Default
- Gabriel Dos Reis: Large Scale C ++ with Modules: What You Should Know
- Neil MacIntosh: More Than Lint: Modern Static Analysis for C ++
- Neil MacIntosh: A Few Good Types: Evolving array_view and string_view for Safe C ++ Code
- Gabriel dos Reis: Contracts for Dependable C ++
- Eric Niebler: Ranges and the Future of the STL
If you are interested in one of the reports, then professional recordings of speeches from CppCon 2015 will be ready in about a month and will be open to all.