Our news and insights blog

We cover a wide variety of interesting technology topics from this fast moving industry.

C++ Core Guidelines

C++ Core Guidelines

C++ is often touted as "the language for smart people" -- and that's not always a compliment. With its flexibility and power come boundless opportunities for disaster. The C++ Core Guidlines is a a new guide by the Bjarne Stroustrup, the creator of C++, advocating the use of a subset of the C++ language and teaches a set of rules for creating sefer faster and easier to understand code.

Stroustrup said: "You can write C++ programs that are statically type safe and have no resource leaks. You can do that without loss of performance and without limiting C++'s expressive power. This supports the general thesis that garbage collection is neither necessary nor sufficient for quality software. Our core C++ guidelines makes such code simpler to write than older styles of C++ and the safety can be validated by tools that should soon be available as open source."

These guidelines are online and the GitHub site. You can download a copy, but I prefer to use the live version, because it's always up-to-date. You can explore some of the other areas in the repo -- learn who's working on it (the inventor of the language and the head of the ISO C++ Standards Committee, for two, and they have some illustrious company). They're written as a series of, well, guidelines, telling you not to use certain patterns, to prefer one approach to another and so on. Almost all of them have an explanation and a code sample, though some are still incomplete. They're organized into sections: Functions, Resource Management, Concurrency, and so on, and there are plenty of links back and forth within the document and to other resources.

Stroustrup is involved in two "C++ Core Guidelines" related projects;

Guideline Support Library (GSL): First, the C++ Core Guidelines also specifies a small Guideline Support Library (GSL), a set of common types like array\_view and not\_null to facilitate following the modern guidelines. An initial open source reference implementation contributed and supported by Microsoft is now available on GitHub at It is written in portable C++ that should work on any modern compiler and platform, and has been tested on Clang/LLVM 3.6 and GCC 5.1 for Linux, with Xcode and GCC 5.2.0 for OS X, and with Microsoft Visual C++ 2013 (Update 5) and 2015 for Windows. This is both a supported library and an initial reference implementation; other implementations by other vendors are encouraged, as are forks of and contributions to this implementation.

Checker tool: Second, the C++ Core Guidelines are designed to be machine-enforceable wherever possible, and include many rules that can be checked by a compiler, lint, or other tool. An initial implementation based on Microsoft's Visual Studio will be made available as a Windows binary in October, with the intention to open source the implementation thereafter. This too will become a supported tool and an initial reference implementation open to others; other implementations by other vendors of compilers, linters, and other tools are encouraged.

Share this Post


Let's get started

Drop us a line or give us a ring; we'd love to hear from you
and answer any questions that you might have.

Call Us Now

Office:    (08) 8395 8007
Mobile:   0403 328 395

Send us an Email



Send us a Message

Message has been sent to us.
Error sending your message.