Appendix A. Appendix – Standard C++ summary tables

Table of Contents
A.1. ASCII code table
A.2. Reserved keywords in C++
A.3. Escape characters
A.4. C++ data types and their range of values
A.5. Statements in C++
A.6. C++ preprocessor directives
A.7. Precedence and associativity of C++ operations
A.8. Some frequently used mathematical functions
A.9. C++ storage classes
A.10. Input/Output (I/O) manipulators
A.11. The standard C++ library header files

A.1. ASCII code table

CHAR

DEC

HEX

 

CHAR

DEC

HEX

 

CHAR

DEC

HEX

 

CHAR

DEC

HEX

[NUL]

0

00

   

32

20

 

@

64

40

 

`

96

60

[SOH]

1

01

 

!

33

21

 

A

65

41

 

a

97

61

[STX]

2

02

 

"

34

22

 

B

66

42

 

b

98

62

[ETX]

3

03

 

#

35

23

 

C

67

43

 

c

99

63

[EOT]

4

04

 

$

36

24

 

D

68

44

 

d

100

64

[ENQ]

5

05

 

%

37

25

 

E

69

45

 

e

101

65

[ACK]

6

06

 

&

38

26

 

F

70

46

 

f

102

66

[BEL]

7

07

 

'

39

27

 

G

71

47

 

g

103

67

[BS]

8

08

 

(

40

28

 

H

72

48

 

h

104

68

[HT]

9

09

 

)

41

29

 

I

73

49

 

i

105

69

[LF]

10

0A

 

*

42

2A

 

J

74

4A

 

j

106

6A

[VT]

11

0B

 

+

43

2B

 

K

75

4B

 

k

107

6B

[FF]

12

0C

 

,

44

2C

 

L

76

4C

 

l

108

6C

[CR]

13

0D

 

-

45

2D

 

M

77

4D

 

m

109

6D

[SO]

14

0E

 

.

46

2E

 

N

78

4E

 

n

110

6E

[SI]

15

0F

 

/

47

2F

 

O

79

4F

 

o

111

6F

[DLE]

16

10

 

0

48

30

 

P

80

50

 

p

112

70

[DC1]

17

11

 

1

49

31

 

Q

81

51

 

q

113

71

[DC2]

18

12

 

2

50

32

 

R

82

52

 

r

114

72

[DC3]

19

13

 

3

51

33

 

S

83

53

 

s

115

73

[DC4]

20

14

 

4

52

34

 

T

84

54

 

t

116

74

[NAK]

21

15

 

5

53

35

 

U

85

55

 

u

117

75

[SYN]

22

16

 

6

54

36

 

V

86

56

 

v

118

76

[ETB]

23

17

 

7

55

37

 

W

87

57

 

w

119

77

[CAN]

24

18

 

8

56

38

 

X

88

58

 

x

120

78

[EM]

25

19

 

9

57

39

 

Y

89

59

 

y

121

79

[SUB]

26

1A

 

:

58

3A

 

Z

90

5A

 

z

122

7A

[ESC]

27

1B

 

;

59

3B

 

[

91

5B

 

{

123

7B

[FS]

28

1C

 

<

60

3C

 

\

92

5C

 

|

124

7C

[GS]

29

1D

 

=

61

3D

 

]

93

5D

 

}

125

7D

[RS]

30

1E

 

>

62

3E

 

^

94

5E

 

~

126

7E

[US]

31

1F

 

?

63

3F

 

_

95

5F

 

[DEL]

127

7F

A.2. Reserved keywords in C++

and

double

not

this

and_eq

dynamic_cast

not_eq

throw

asm

else

operator

true

auto

enum

or

try

bitand

explicit

or_eq

typedef

bitor

export

private

typeid

bool

extern

protected

typename

break

false

public

union

case

float

register

unsigned

catch

for

reinterpret_cast

using

char

friend

return

virtual

class

goto

short

void

compl

if

signed

volatile

const

inline

sizeof

wchar_t

const_cast

int

static

while

continue

long

static_cast

xor

default

mutable

struct

xor_eq

delete

namespace

switch

 

do

new

template

 

In the 1998 ANSI/ISO C++ standard

alignas

char32_t

final

override

alignof

constexpr

noexcept

static_assert

char16_t

decltype

nullptr

thread_local

Additional keywords added by the C++11 standard

A.3. Escape characters

Description

ASCII character

Escape sequence

audible bell (alert)

BEL

'\a'

backspace

BS

'\b'

form feed – new page

FF

'\f'

line feed - new line

NL (LF)

'\n'

carriage return

CR

'\r'

horizontal tab

HT

'\t'

vertical tab

VT

'\v'

single quote

'

'\''

double quote

"

'\"'

backslash

\

'\\'

question mark

?

'\?'

ANSI character with an octal code

ooo

'\ooo'

Null character

NUL

'\0'

ANSI character with a hexadecimal code

hh

'\xhh'

16-bit Unicode character

hhhh

'\uhhhh'

32-bit Unicode character

hhhhhhhh

'\Uhhhhhhhh'

A.4. C++ data types and their range of values

Data type

Range of values

Size

(bytes)

Precision

(digits)

bool

false, true

1

 

char

-128..127

1

 

signed char

-128..127

1

 

unsigned char

0..255

1

 

wchar_t

0..65535

2

 

int

-2147483648..2147483647

4

 

unsigned int

0..4294967295

4

 

short

-32768..32767

2

 

unsigned short

0..65535

2

 

long

-2147483648..2147483647

4

 

unsigned long

0..4294967295

4

 

long long

-9223372036854775808.. 9223372036854775807

8

 

unsigned long long

0..18446744073709551615

8

 

float

3.4E-38..3.8E+38

4

6

double

1.7E-308..1.7E+308

8

15

long double

3.4E-4932..3.4E+4932

10

19

A.5. Statements in C++

Category

C++ statements

Declaration/definition statements

types (class, struct, union, enum, typedef), functions, objects

Expression statements

expression;

Empty statement

;

Compound statement

{ statements }

Selection statements

if, else,switch, case

Iteration statements

do, for, while

Flow control statements

break, continue, default, goto, return

Exception handling statements

throw, try-catch

A.6. C++ preprocessor directives

Category

Directive

Conditional directive

#ifdef, #ifndef, #if, #endif, #else, #elif

Defining symbols/macros

#define

Undefining symbols/macros

#undef

Including source files

#include

Generating compilation errors

#error

Modifying the line number (and file name) in compilation messages

#line

Implementation dependent control of the compilation process

#pragma

Predefined macros

Macro

Description

__DATE__

String containing the date of the compilation.

__TIME__

String containing the time of the compilation.

__FILE__

String containing the name of the source file.

__LINE__

A numeric constant containing the actual line number of the source file (numbering starts from 1).

__STDC__

Its value is 1 if the compiler works as an ANSI C++ compiler, otherwise it is not defined.

__cplusplus

Its value is 1, if in a C++ source file, otherwise it is not defined.

__cplusplus_cli

Its value is 1, if in a C++/CLI source file, otherwise it is not defined.

A.7. Precedence and associativity of C++ operations

Precedence

Operator

Name or meaning

Associativity

1.

::

scope resolution

none

2.

( )

function call, member initialization

from left to right

[ ]

array indexing

->

indirect member selection (pointer)

.

direct member selection (object)

++

(postfix) increment

--

(postfix) decrement

type ()

type-cast (conversion)

dynamic_cast

checked type-cast at runtime (conversion)

static_cast

checked type-cast during compilation time (conversion)

reinterpret_cast

unchecked type-cast (conversion)

const_cast

constant type-cast (conversion)

typeid

type identification

3.

!

logical negation (NOT)

from right to left

~

bitwise negation

+

+ sign (numbers)

-

- sign (numbers)

++

(prefix) increment

--

(prefix) decrement

&

address-of operator

*

indirection operator

( type )

type-cast (conversion)

sizeof

size of an object/type in bytes

new

allocating dynamic memory space

delete

deallocating dynamic memory space

4.

.*

direct reference to a class member

from left to right

->*

indirect reference to a member of the object the pointer points to

5.

*

multiplication

from left to right

/

division

%

modulo

6.

+

addition

from left to right

subtraction

7.

<<

bitwise left shift

from left to right

>>

bitwise right shift

8.

<

less than

from left to right

<=

less than or equals

>

greater than

>=

greater than or equals

9.

==

equal to

from left to right

!=

not equal to

10.

&

bitwise AND

from left to right

11.

|

bitwise inclusive OR

from left to right

12.

^

bitwise exclusive OR (XOR)

from left to right

13.

&&

logical AND

from left to right

14.

||

logical OR

from left to right

15.

expr ? expr : expr

conditional expression

from right to left

16.

=

simple value assignment

from right to left

*=

multiplication assignment

/=

division assignment

%=

modulo assignment

+=

addition assignment

-=

subtraction assignment

<<=

bitwise left shift assignment

>>=

bitwise right shift t assignment

&=

bitwise AND assignment

^=

bitwise XOR assignment

|=

bitwise OR assignment

17.

throw expr

throwing an expression

from right to left

18.

expr , expr

operation sequence (comma operator)

from left to right

A.8. Some frequently used mathematical functions

Usage

Type

Function

Include file

calculation of absolute value

real

fabs(real x)

cmath

calculation of absolute value

integer

abs(integer x)

cstdlib

cosine of an angle (in radians)

real

cos(real x)

cmath

sine of an angle (in radians)

real

sin(real x)

cmath

tangent of an angle (in radians)

real

tan(real x)

cmath

the inverse cosine of the argument (in radians)

real

acos(real x)

cmath

the inverse sine of the argument (in radians)

real

asin(real x)

cmath

the inverse tangent of the argument (in radians)

real

atan(real x)

cmath

the inverse tangent of y/x (in radians)

real

atan(real x, real y)

cmath

natural logarithm

real

log(real x)

cmath

base 10 logarithm

real

log10(real x)

cmath

ex  

real

exp(real x)

cmath

power (xy)

real

pow(real x, real y)

cmath

square root

real

sqrt(real x)

cmath

random number between 0 and RAND_MAX

real

int rand(void)

cstdlib

the value of π

real

4.0*atan(1.0)

cmath

Where the type real designates one of the following types: float, double or long double. The type integer designates one of the int or long types

A.9. C++ storage classes

Properties

Result

Scope

Item

Storage class

Lifetime

Visibility

file-level

variable definition

static

global

restricted to a given file, from its definition to the end of the file

variable declaration

extern

global

from its definition to the end of the file

prototype or function definition

static

global

restricted to the given file

function prototype

extern

global

from its definition to the end of the file

block-level

variable declaration

extern

global

block

variable definition

static

global

block

variable definition

auto

local

block

variable definition

register

local

block

A.10. Input/Output (I/O) manipulators

Parameterless manipulators <iostream>

The following manipulators are used in pairs, they have their effects from the time they are set until they are unset:

Manipulator

Stream

Description (when they are set)

boolalpha

noboolalpha

I/O

The logical values can be provided with the keywords true and false.

showbase

noshowbase

O

The sign of the numeral system is also printed out before numbers (0 or 0x).

showpoint

noshowpoint

O

Decimal point is always printed.

showpos

noshowpos

O

A plus sign always printed out for any number that is not negative.

skipws

noskipws

I

Discarding whitespace characters.

unitbuf

nounitbuf

O

Flushing the buffer automatically after each operation.

uppercase

nouppercase

O

When numbers are printed out, (e and x) will always be uppercase

Some manipulators modifying data streams:

Manipulator

Stream

Description

endl

O

Insert newline and flush.

ends

O

Insert null character.

flush

O

Flush the stream buffer.

ws

I

Extract whitespaces.

The effects of the following manipulators can be modified by those provided in the same group:

Manipulator

Stream

Description

Alignment

left

O

Left-aligned

right

O

Right-aligned - default

internal

O

The output is padded to the field as best as possible by inserting filler characters

Numeral system

dec

I/O

Decimal - default

hex

I/O

Hexadecimal

oct

I/O

Octal

Printing out real numbers (if these manipulator flags are not set, the compiler decides their format)

fixed

O

Fixed-point notation

scientific

O

Scientific notation

Parameterized manipulators <iomanip>:

setw affects only the data element that immediately follows him, and the others affect all subsequent data elements for the output stream.

Manipulator

Stream

Description

setfill(nFill )

O

Set fill character.

setprecision(np)

O

Set decimal precision.

setw(nw);

O

Set field width.

setbase(nb);

O

Sets the numeric base field (8,10,16).

A.11. The standard C++ library header files

C++ language library

 

Types (NULL, size_t etc.)

<cstddef>

Limits of different types

<limits>, <climits>, <cfloat>

Program control

<cstdlib>

Dynamic memory handling

<new>

Type identification

<typeinfo>, <typeindex>, <type_traits>

Exception handling types

<exception>

Other run-time support

<cstdarg>, <csetjmp>, <ctime>, <csignal>, <cstdlib>,<cstdbool>, <cstdalign>

Diagnostic library

 

Exception classes

<stdexcept>

Assert macros

<cassert>

Error codes

<cerrno>

System error support

<system_error>

Library of general services

 

Function elements (STL)

<utility>

Function objects (STL)

<functional>

High level memory handling (STL)

<memory>, <scoped_allocator>

Special class templates (STL)

<bitset>, <tuple>

Date and time handling

<ctime> , <chrono>

String library

 

String classes

<string>

C-style string handling

<cctype>, <cwctype>, <cstring>, <cwchar>, <cstdlib>, <cuchar>

Library of country-specific (local) settings

 

Localization utilities

<locale>

C localization utilities

<clocale>

Unicode conversion facilities

<codecvt>

Library of containers (STL)

 

Sequential containers (STL)

<array>, <deque>, <list>, <vector>, <forward_list>

Associative containers (STL)

<map>,  <set>

Unordered associative containers(STL)

<unordered _map>, <unordered_set>

Container adaptors (STL)

<queue>, <stack>

Library of iterators (generic pointers) (STL)

 

Iterator elements, predefined iterators, data stream iterators (STL)

<iterator>

Algorithms library

 

Algorithms that operate on containers (STL)

<algorithm>

Algorithms of the C library

<cstdlib>

Numeric library

 

Complex number type

<complex>

Representing and manipulating arrays of values

<valarray>

Numeric operations on values in containers

<numeric>

The numeric elements of the C library

<cmath>, <cstdlib>, <ctgmath>

Compile-time rational arithmetic

<ratio>

Random number generators and distributions

<random>

Floating-point environment access functions

<cfenv>

Standard Input/Output library

 

Forward declarations of all I/O classes

<iosfwd>

Standard iostream objects

<iostream>

The base class of the iostream classes

<ios>

Data stream buffers

<streambuf>

Data formatting and manipulators

<istream>, <ostream>, <iomanip>

String data streams

<sstream>

File data streams

<fstream>, <cstdio>, <cinttypes>

Regular expressions library

 

Regular expression processing.

<regex>

Functions for concurrent programming

 

Atomic types and  operations

<atomic>

Thread support library

 

Creating and controlling threads

<thread>, <mutex>, <condition_variable>, <future>

The underscored names are the header files of the C++11 standard.