Tutorial by Examples

A specifier that can be applied to the declaration of a non-static, non-reference data member of a class. A mutable member of a class is not const even when the object is const. class C { int x; mutable int times_accessed; public: C(): x(0), times_accessed(0) { } int get...
C++17 A storage class specifier that hints to the compiler that a variable will be heavily used. The word "register" is related to the fact that a compiler might choose to store such a variable in a CPU register so that it can be accessed in fewer clock cycles. It was deprecated starting ...
The static storage class specifier has three different meanings. Gives internal linkage to a variable or function declared at namespace scope. // internal function; can't be linked to static double semiperimeter(double a, double b, double c) { return (a + b + c)/2.0; } // exported to c...
C++03 Declares a variable to have automatic storage duration. It is redundant, since automatic storage duration is already the default at block scope, and the auto specifier is not allowed at namespace scope. void f() { auto int x; // equivalent to: int x; auto y; // illegal in C++; ...
The extern storage class specifier can modify a declaration in one of the three following ways, depending on context: It can be used to declare a variable without defining it. Typically, this is used in a header file for a variable that will be defined in a separate implementation file. // glo...

Page 1 of 1