Title: Theory / Unimportant / CS / Programming / C Harbison Steele{ / 05 Type+11
Tags: récupéré FromVariables hasSeenConjDef TypToProperty fromAlgorithm has_seen_instruction_2 type
On every note of this deck, unless a note says otherwise:
Chapter: 5

Name: A type
Definition: a set of value
Page: 123
Definition2: a set of operations on those values
Conjdef: both

Name: A variable of type t
Definition: A variable whose values are constrained to be of type t
Page: 123
Variables: t a type

Name: Integral type
Definition: all form of integer types
Page: 123
Definition2: characters
Conjdef: Contains
Definition3: enumerations
Definition4: _Bool

Name: Arithmetic type
Definition: Integral type
Page: 123
Context: C
Definition2: Floating point types
Conjdef: Contains

Name: Scalar type
Definition: Arithmetic type
Page: 123
Definition2: pointers type
Conjdef: Contains

Name: Function types
Definition: type of «function returning»
Page: 123

Name: Aggregate types
Definition: arrays
Page: 123
Definition2: structure
Conjdef: Contains

Name: void type
Definition: Type with no value nor operation
Page: 123

Name: union type
Definition: type created with the union operator
Page: 123

Name: A domain
Definition: A set of type
Page: 123
Context: C

Name: The complex domain
Definition: The 6 complex type
Page: 123
Context: C language

Name: The real domain
Definition: The domain of real types
Page: 123

Name: A real floating type
Definition: float
Page: 124
Index: 1
Definition2: double
Definition3: long double

Name: A real type
Definition: An arithmetical type which is not a complex type
Page: 123

Name: Complex types
Definition: float _Complex
Page: 124
Index: 1
Definition2: double _Complex
Conjdef: Contains
Definition3: long double  _Complex
Definition4: foal _Imaginary
Definition5: double _Imaginary
Definition6: long double _Imaginary

Name: Floating point types
Definition: Complex and real floating point type
Page: 124
Index: 1

Name: Floating point types
Definition: float, double, long double
Page: 124
Definition2: the preceding, with _Imaginary or _Complex
Conjdef: All of

Name: Real type
Definition: Any arithmetic type which is neither _Imaginary nor _Complex
Page: 124

Name: Pointer type
Page: 124
Notation: T*

Name: Scalar type
Definition: Arithmetic type
Page: 124
Context: C
Definition2: Pointer type
Conjdef: Either

Name: Aggregate type
Definition: Array type
Page: 124
Context: C
Definition2: Structure type
Conjdef: Either

Name: The types in C
Definition: Scalar type
Page: 124
Context: C
Definition2: Aggregate type
Conjdef: Either
Definition3: Union type
Definition4: Function type
Definition5: Void type

Question: When neither signed nor unsigned is stated, which is the default
Answer: unsigned for char signed otherwise
Page: 125
Chapter: 5
Section: 1.1
Context: C

Name: short
Definition: at least 16 bits wide integer
Page: 125
Section: 1.1
Context: C
Name2: short int

Name: char
Definition: at least 8 bits wide integer
Page: 125
Section: 1.1
Context: C

Name: long int
Definition: at least 32 bits wide integer
Page: 125
Section: 1.1
Context: C
Name2: long

Name: long long int
Definition: at least 64 bits wide integer
Page: 125
Section: 1.1
Context: C

Variable: limits.h
Meaning: The actual ranges of the integer types
Page: 125
Language: C
Section: 1.1
Chapter: 5
Typ: file

Name: Two-complement notation
Definition: notation where a number \(a_{n-1}\dots a_{0}\) encodes \(-a_{n-1}2^{n-1}+\sum_{i=0}^{n-2}a_i2^i\)
Page: 125
Section: 1.1
Context: C
Property: integers from \(-2^{n-1}\) to \(2^{n-1}-1\)

Page: 125
Implementation: Inversing every bit on the left of the right-most 1
Section: 1.1
Chapter: 5
Effect: \(x\mapsto -x\) in 2-complement notation
Variables: \(n\in\mathbb N\)
Language: C

Name: one-complement notation
Definition: Integer encoding such that \(a_{n-1}\dots a_{0}\) encodes the unsigned integer \(a_{n-2}\dots a_{0}\) if \(a_{n-1}=0\), and the unsigned integer \(\neg a_{n-2}\dots a_{0}\) otherwise
Page: 125
Section: 1.1
Variables: \(n\in\mathbb N\)
Context: C
Property: Encode numbers in \([-2^{n-1}-1,2^{n-1}-1]\)

Name: sign magnitude notation
Definition: Integer encoding such that \(a_{n-1}\dots a_{0}\) encodes the unsigned integer \(a_{n-2}\dots a_{0}\) if \(a_{n-1}=0\), and its negation otherwise
Page: 125
Section: 1.1
Variables: \(n\in\mathbb N\)
Context: C
Property: Encode numbers in \([-2^{n-1}-1,2^{n-1}-1]\)

Variable: foo_MIN
Meaning: minimum values represented in type foo
Page: 125
Language: C
Section: 1.1
Chapter: 5
Typ: constant
Variables: \(n\in\mathbb N\)

Question: Which values are truthy
Answer: Everything but 0
Page: 127
Chapter: 5
Section: 1.1
Context: C
Kind: constant

Question: Operation using signed and unsigned
Answer: converts signed to unsigned
Page: 129
Chapter: 5
Section: 1.2
Context: C

Typ: char (without signed nor unsigned)
Meaning: either equivalent to signed char, or to unsigned char, depending on compiler
Page: 129
Language: C
Chapter: 5
Section: 1.3
Name: plain character type

Question: Why is the question of sign bit of char important ?
Answer: Because reading a file should return a negative value when EOF is found, and if it compared to a signed char, this negative value may be modified unexpectedly
Page: 131
Chapter: 5
Section: 1.3
Context: C

Question: Conversion to _Bool
Answer: The function sending 0 to 0 and everything else to 1
Page: 131
Chapter: 5
Section: 1.3
Context: C