The C++ core guidelines have about twenty naming and layout rules. A few of them are obvious; a few of them may be controversial. Let's see, what I mean.
The lifetime safety profile in the C++ core guidelines boils down to one issue: don't dereference a possible invalid pointer. A pointer may be invalid because it is not initialised or the nullptr. A pointer may also point beyond its rage or to a deleted object.
Today's post is about the second profile of the C++ Core Guidelines: Bounds Safety. The goal of the profile bounds safety is it that you operate inside the bounds of allocated memory.
What does that mean: type safety by design. Type safety by design just means, that you always initialise your variables, use std::variant instead of a union, or prefer variadic templates and fold expressions to va_arg's.
The C++ core guidelines support three profiles: type safety, bounds safety, and lifetime safety. Thanks to the guideline support library (GSL), you can check your code against these profiles. Today, I start with the profile type safety.
Informally, profiles are a subset of rules of the C++ core guidelines for specific concerns such as type safety, bounds safety, and lifetime safety. Thanks to the guideline support library, they can be checked
Today, I conclude my story to your myths about C++. These myths are around function parameters, the initialisation of class members, and pointer versus references.
Now, it's time to choose the next pdf bundle? You will get all posts, all source files, and a cmake file to the chosen topic.
I was very curious about your C++ myths. In particular, my German readers were quite active. I got a few E-Mails and observed a vivid discussion on Heise Developer.
Demystifying non-rules and myths in C++ is a laborious but absolutely necessary job. The goal is simple: use the powerful tool C++ appropriately.
Hunting
Today 187
Yesterday 7013
Week 15110
Month 90161
All 6111225
Currently are 111 guests and no members online
Kubik-Rubik Joomla! Extensions
Read more...
Read more...