Title: Theory / Unimportant / CS / Programming / C++ / Manual / Norm / 07 Pointers;
Tags: computer_to_instruction FromInstruction hasNotNewEffectReturnsMeaning type has_seen_instruction_2 seen_description

Typ: t*
Meaning: «pointer to t»
Page: 172
Language: C++
Chapter: 7
Section: 2
Variables: t a type

Instruction: *o
Page: 172
Language: C++
Chapter: 7
Section: 2
Returns: The value referrenced by o
Variables: t a type
o a value of type t*
Typ: t
Name: dereferencing o

Instruction: &o
Page: 172
Language: C++
Chapter: 7
Section: 2
Returns: A pointer to the address (identity) of o
Variables: t a type
o a value of type t
Extra: doublon ?
Typ: t*

Name: pointer to
Page: 172
Chapter: 7
Section: 2
Variables: t a type
o a value of type t
Context: C++ standard
Notation: *

Typ: void*
Meaning: pointer to an object of unknown type (not function nor member)
Page: 172
Language: C++
Chapter: 7
Section: 2.1

Question: void* can
Answer: be comparred
Page: 172
Chapter: 7
Section: 2.1
Context: C++ standard
Answer2: be cast
Answer3: be assigned to other void*

Instruction: ar [m]
Page: 173
Language: C++
Chapter: 7
Section: 3
Returns: the m-th element of ar
Variables: t a type
n an integral constant
m int
ar of type t[n]
Assuming: m's value is less than n
Typ: t
Name: subscript

Instruction: ar [m]= foo
Page: 173
Effect: assign the value foo to the m-th element of ar
Language: C++
Chapter: 7
Section: 3
Variables: t a type
n an integral constant
m int
ar of type t[n]
foo of type t
Assuming: m's value is less than n

Instruction: "foo"
Page: 175
Language: C++
Chapter: 7
Section: 3.1
Returns: An array containing the text foo and a 0 after it
Name: String litteral

Instruction: char p[]= "foo"
Page: 175
Language: C++
Chapter: 7
Section: 3.1
Returns: assign p to a mutable string initialized with text foo

Instruction: "foo"
"bar"
Page: 175
Language: C++
Chapter: 7
Section: 3.1
Returns: A string containing the concatenation of foo and of bar

Name: Indirection
Definition: The action of dereferencing
Page: 172
Chapter: 7
Section: 2

Typ: t *const
Meaning: A constant pointer to an element of type t
Page: 187
Language: C++
Chapter: 7
Section: 4.3
Variables: t a type

Typ: t const*
Meaning: A pointer to a constant element of type t
Page: 187
Language: C++
Chapter: 7
Section: 4.3
Variables: t a type

Question: What is the difference between const* and *const ?
Answer: const* is a pointer to a constant value
*const is a constant pointer
Page: 186
Chapter: 7
Section: 5
Context: C++
Intuition: This should be read right to left.
"A pointer to a constant"
or "A constant pointer"

Question: What is the relation between const t and t
Answer: An element of type t can be coerced to const t, not the reverse
Page: 187
Chapter: 7
Section: 5
Variables: t a type
Context: C++

Name: A resource
Definition: Something that need to be acquired and then released
Page: 188
Chapter: 7
Section: 6
Context: C++
Example: Memory with new/delete
Example2: File with fopen and fclose

Question: When to prefere pointer over reference
Answer: If you need to change the object to refere to (e.g. iterator)
Page: 196
Chapter: 7
Section: 7.4
Context: C++
Answer2: you want a collection of something that refers to an object
Answer3: If you need a notion of "no value", you can use nullptr
Answer4: If you want to transfer ownership and must avoid value