Appendix A: Language Reference Tables
This appendix gathers compact reference tables that you can consult quickly while working. They summarize essential facts without long explanation. Earlier chapters give full detail; the tables here provide fast reminders during coding or review.
Keywords and reserved identifiers
C++ reserves a small core of keywords for language features and implementation needs. These names cannot be used for your own identifiers. Some are contextual and appear only in templates or special constructs. The list below reflects the common set from current C++ standards.
Core keywords
The following table lists the fundamental keywords that appear in code across the language’s main features. They map to control flow, declarations, types, and basic operators.
| Keyword | Purpose |
| auto | Type deduction for variables and return types |
| bool | Boolean type |
| break | Exit the nearest loop or switch |
| case | Label in a switch statement |
| catch | Exception handler block |
| char | Character type |
| class | User defined class type |
| const | Read only qualifier |
| continue | Skip to the next loop iteration |
| decltype | Infer type from an expression |
| default | Default label in switch or defaulted functions |
| delete | Destroy a dynamically allocated object |
| do | Start a do while loop |
| double | Double precision floating point |
| else | Alternative path in if statements |
| enum | Enumeration type |
| explicit | Disable implicit conversions |
| export | Expose module interfaces |
| extern | External linkage specifier |
| false | Boolean false literal |
| float | Floating point type |
| for | For loop construct |
| friend | Access control exception for classes |
| goto | Jump to a label |
| if | Conditional branching |
| inline | Inline expansion hint |
| int | Integer type |
| long | Long integer type |
| mutable | Allow modification in const objects |
| namespace | Logical grouping of declarations |
| new | Allocate objects dynamically |
| noexcept | Declare non throwing functions |
| nullptr | Null pointer literal |
| operator | Define overloaded operators |
| private | Private access level |
| protected | Protected access level |
| public | Public access level |
| return | Return from a function |
| short | Short integer type |
| signed | Signed integer qualifier |
| sizeof | Size of an expression or type |
| static | Static storage or linkage |
| struct | Structure type |
| switch | Multi way branching |
| template | Define templates |
| this | Pointer to current object |
| throw | Raise an exception |
| true | Boolean true literal |
| try | Start a guarded block for exceptions |
| typedef | Alias a type |
| typename | Type placeholder in templates |
| union | Storage overlay type |
| unsigned | Unsigned integer qualifier |
| using | Introduce names or type aliases |
| virtual | Declare virtual functions |
| void | Empty type |
| volatile | Prevent certain optimizations |
| while | Loop while a condition holds |
Operator precedence and associativity
Operator precedence determines how expressions bind when parentheses are absent. Associativity resolves ties at the same level. When expressions become dense, add parentheses for clarity even when precedence rules cover the case.
Precedence table
The following table shows a compact precedence ladder. Rows near the top bind more tightly than rows near the bottom. The associativity column explains the direction rules when operators share a level.
| Operators | Associativity |
| :: | Left to right |
| ++ -- () [] . -> | Left to right |
| ! ~ + - * & sizeof noexcept new delete | Right to left |
| * / % | Left to right |
| + - | Left to right |
| << >> | Left to right |
| < <= > >= | Left to right |
| == != | Left to right |
| & | Left to right |
| ^ | Left to right |
| | | Left to right |
| && | Left to right |
| || | Left to right |
| ?: | Right to left |
| = += -= *= /= %= &= |= ^= <<= >>= | Right to left |
| , | Left to right |
Numeric limits and sizes
The exact sizes of integer and floating point types vary by platform, but common implementations follow patterns. The table provides typical values from platforms that use 8 bit bytes and two’s complement integers. Always confirm with std::numeric_limits<T> at compile time if your code depends on exact ranges.
Common sizes
The table shows representative bit widths and ranges, not strict guarantees. Your platform may differ.
| Type | Typical bits | Approximate range |
| char | 8 | 0 to 255 or -128 to 127 |
| short | 16 | -32768 to 32767 |
| int | 32 | -2 billion to 2 billion |
| long | 32 or 64 | Platform dependent |
| long long | 64 | About -9e18 to 9e18 |
| float | 32 | Approx 1e-38 to 1e38 |
| double | 64 | Approx 1e-308 to 1e308 |
| long double | 64 to 128 | Platform dependent |
| std::size_t | 32 or 64 | Non negative, depends on pointer size |
| std::ptrdiff_t | 32 or 64 | Signed difference type |
std::uint32_t or std::int64_t when exact sizes matter, for example in serialization formats.
Compiler flag crib sheet
Compilers offer flags that control standards, warnings, optimization, sanitizers, and debugging. The tables here list commonly used flags for GCC, Clang, and MSVC. Exact spellings may vary slightly by version.
Language and warnings
Choose a standard version explicitly and enable strong warnings during development. These flags help catch mistakes before runtime.
| Compiler | Flags |
| GCC | -std=c++23, -Wall, -Wextra, -Wpedantic |
| Clang | -std=c++23, -Wall, -Wextra, -Wpedantic |
| MSVC | /std:c++23, /W4, /permissive- |
Optimization and debugging
Switch between optimization levels depending on context. Fast builds use no optimization; release builds use higher levels. Include debugging information during development.
| Compiler | Flags |
| GCC | -O0, -O2, -O3, -g |
| Clang | -O0, -O2, -O3, -g |
| MSVC | /Od, /O2, /Zi |
Sanitizers
Sanitizers catch memory errors, undefined behavior, and threading races. Use them in CI and during development to prevent subtle bugs from reaching production.
| Purpose | Flags |
| Address checks | -fsanitize=address |
| Undefined behavior | -fsanitize=undefined |
| Thread safety | -fsanitize=thread |
| Leak detection | -fsanitize=leak |