during reading the book, I realized that I have to keep keywords and concepts in mind to continue to read book. And here is some impotant keywords from chapter6.
Type category names.
Boolean, character, integer types are called integral types.
integral types and floating-point types are collectively called arithmetic types.
Enumerations + class are called user-defined types
fundamental types, pointers, references are called built-in types.
Initialization
There are four ways to initialize a variable.
X a1{v};
X a2 = {v};
X a3 = v;
X a4(v);
The first one is new in C++11. This one do not perform the type conversion(narrowing?). and checked in compile time. Bjarne recommends this one. The other three ways are old.
classification of objects based on their lifetimes:
1. Automatic
an object declared in a function is created when its definition is encountered and destroyed when its name goes out of scope.
2. Static
Objects declared in global or namespace scope and statics declared in functions or classes are and initialized once(only) and "live" until program terminates
3. Free Store
Objects created and deleted by using the new and delete operators.
4. Temporary objects (i will complete this later)
5. Thread-local objects. (i will complete this later)
and last thing from this chapter is type alias.
in C++ there was a keyword "using" to alias the type.
1: template<class T>
2: class vector {
3: using value_type = T;
4: ...
5: };
No comments:
Post a Comment