Skip to content

Commit 62105fd

Browse files
authored
Merge branch 'master' into Issue5
2 parents 304bec9 + fd6fabb commit 62105fd

14 files changed

+605
-6
lines changed

config/spellcheck/ignored_words.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
args
2+
asm
3+
baz
24
Bjarne
5+
bool
36
checkmark
7+
coe
48
constexpr
59
cppreference
610
Engelhart
11+
enum
712
EPUB
813
errno
914
expr
15+
explorative
16+
extern
1017
Florian
1118
func
1219
Furst
@@ -16,8 +23,11 @@ Hyland
1623
JC
1724
Krathwohl
1825
ness
26+
nothrow
1927
NRVO
28+
RAII
2029
req
30+
Rethrowing
2131
RVO
2232
Sattler
2333
SG

config/spellcheck/wordlist

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
personal_ws-1.1 en 18
21
ABI
2+
API
3+
APIs
34
boolean
45
computable
56
destructors
@@ -10,6 +11,7 @@ metaprogramming
1011
namespace
1112
namespaces
1213
ODR
14+
personal_ws-1.1 en 18
1315
preprocessor
1416
redeclarations
1517
SFINAE

sources/knowledge_areas.dat

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ P Preprocessor
1212
? ? ? ? Macros
1313
B Basics Types, Objects, Values, Expressions, Statements, and Control-Flow Constructs
1414
? ? ? ? Constant Objects
15-
? ? ? ? Declarations and Definitions
15+
? ? ? ? Declarations
16+
def y y y Definitions
1617
? ? ? ? Selection Constructs (e.g., if, ternary)
1718
? ? ? ? Looping Constructs (e.g., for, while, etc.)
1819
F Functions
@@ -50,10 +51,10 @@ T Generic Programming (Templates)
5051
? ? ? ? Requires Clauses
5152
req-expr y y n Requires Expressions
5253
EH Error Handling
53-
? ? ? ? Classes of Errors
54+
coe y y n Categories of Errors
5455
? ? ? ? errno
5556
? ? ? ? Error Codes
56-
? ? ? ? Exception Handling
57+
eh y y y Exception Handling
5758
SL Standard Library
5859
? ? ? ? Input/Output (I/O)
5960
? ? ? ? Containers, Iterators, and Algorithms
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## C++ compilation model: Linkage {#linkage}
2+
3+
_Skeleton descriptions are typeset in italic text,_
4+
_so please don't remove these descriptions when editing the topic._
5+
6+
This topic is currently under construction and will soon be filled with information :)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## C++ compilation model: Translation units {#translunits}
2+
3+
_Skeleton descriptions are typeset in italic text,_
4+
_so please don't remove these descriptions when editing the topic._
5+
6+
This topic is currently under construction and will soon be filled with information :)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## Error handling: C-style error codes {#cerrcodes}
2+
3+
_Skeleton descriptions are typeset in italic text,_
4+
_so please don't remove these descriptions when editing the topic._
5+
6+
This topic is currently under construction and will soon be filled with information :)
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
## Error handling: Categories of errors
2+
3+
_Skeleton descriptions are typeset in italic text,_
4+
_so please don't remove these descriptions when editing the topic._
5+
6+
### Overview
7+
8+
_Provides a short natural language abstract of the module’s contents._
9+
_Specifies the different levels of teaching._
10+
11+
------------------------------------------------------------------------
12+
Level Objective
13+
----------------- ------------------------------------------------------
14+
Foundational Categories of errors
15+
16+
Main Handling different categories of errors
17+
18+
Advanced ---
19+
20+
------------------------------------------------------------------------
21+
22+
### Motivation
23+
24+
_Why is this important?_
25+
_Why do we want to learn/teach this topic?_
26+
27+
Programs can run in a normal state or erroneous state. Students should be able
28+
to identify different types of erroneous state and how to best handle them.
29+
30+
### Topic introduction
31+
32+
_Very brief introduction to the topic._
33+
34+
This topic is an umbrella topic that refers to the different topics for types of errors and error handling.
35+
36+
### Foundational: Categories of errors {#coe-found}
37+
38+
#### Background/Required Knowledge
39+
40+
A student:
41+
42+
* should know the basics about linkage [[C++ compilation model: Linkage - Foundational]][1]
43+
44+
#### Student outcomes
45+
46+
_A list of things "a student should be able to" after the curriculum._
47+
_The next word should be an action word and testable in an exam._
48+
_Max 5 items._
49+
50+
A student should be able to:
51+
52+
1. Describe different kinds of errors and exceptional situations that require different approaches of error handling.
53+
2. Provide some examples of the different error categories.
54+
3. Identify potential erroneous code sections and attribute them to different error categories.
55+
56+
57+
#### Caveats
58+
59+
_This section mentions subtle points to understand, like anything resulting in
60+
implementation-defined, unspecified, or undefined behavior._
61+
62+
No caveats at present.
63+
64+
#### Points to cover
65+
66+
_This section lists important details for each point._
67+
68+
Errors can happen at different times during software lifetime.
69+
70+
* Compile-time errors
71+
* Link-time errors
72+
* Execution-time errors
73+
74+
There are different types of errors
75+
76+
* Logic errors (violations of logical preconditions)
77+
* Run-time errors (errors during code execution due to causes that are external to the program)
78+
79+
80+
### Main: Handling different categories of errors {#coe-main}
81+
82+
#### Background/Required Knowledge
83+
84+
#### Student outcomes
85+
86+
A student should be able to:
87+
88+
1. pick the right error handling approach for a given problem.
89+
2. enumerate different error handling strategies.
90+
3. make a clear distinction between error-handling code and normal-case handling code
91+
92+
93+
#### Caveats
94+
95+
* The different error handling strategies have different trade-offs (runtime performance, readability, ...)
96+
* The trade-off space depends on the run-time context (embedded, ...)
97+
* There also exist unhandleable errors (e.g., ODR violations, undefined behavior)
98+
99+
#### Points to cover
100+
101+
* Exception handling [[Error handling: Exception handling - Foundational]][2]
102+
* Returning a value indication failure [[Error handling: C-style error-codes - Foundational]][3]
103+
* Terminating the program
104+
* Improving error handling by having the error occur at an earlier stage in the software development cycle [[Error handling: Static assert - Foundational]][4]
105+
106+
### Advanced {#coe-advanced}
107+
108+
_These are important topics that are not expected to be covered but provide
109+
guidance where one can continue to investigate this topic in more depth._
110+
111+
[1]: ../compilation-model/linkage.md
112+
[2]: ../error-handling/exception-handling.md
113+
[3]: ../error-handling/c-style-error-codes.md
114+
[4]: ../error-handling/static-assert.md
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
## Error handling: Error codes {#ecodes}
2+
3+
_Skeleton descriptions are typeset in italic text,_
4+
_so please don't remove these descriptions when editing the topic._
5+
6+
### Overview
7+
8+
_Provides a short natural language abstract of the module’s contents._
9+
_Specifies the different levels of teaching._
10+
11+
------------------------------------------------------------------------
12+
Level Objective
13+
----------------- ------------------------------------------------------
14+
Foundational Handling error codes with `std::error_code`
15+
16+
Main Designing APIs around `std::error_code`
17+
18+
Advanced ---
19+
20+
------------------------------------------------------------------------
21+
22+
### Motivation
23+
24+
_Why is this important?_
25+
_Why do we want to learn/teach this topic?_
26+
27+
C++ offers a type safe way of passing around errors, contrary to the C-style of error handling, by this, we prevent bugs when passing error codes.
28+
Furthermore, error handling with error codes is more commonly used than exception handling, which only should be used in exceptional situations and in some environments is not feasible at all, e.g., in embedded or performance critical software.
29+
30+
### Topic introduction
31+
32+
_Very brief introduction to the topic._
33+
34+
C++ offers `std::error_code`, which encapsulates error codes in a type safe way.
35+
This topic describes how to use these error codes.
36+
37+
### Foundational: Handling error codes with `std::error_code` {#eh-found}
38+
39+
#### Background/Required Knowledge
40+
41+
A student:
42+
43+
* should know that there are different ways of error handling [[Error handling: Categories of errors]][1]
44+
* should know function return values
45+
46+
#### Student outcomes
47+
48+
_A list of things "a student should be able to" after the curriculum._
49+
_The next word should be an action word and testable in an exam._
50+
_Max 5 items._
51+
52+
A student should be able to:
53+
54+
1. write code to handle errors with `std::error_code`, e.g., obtain the message of the error code or check if an error occurred.
55+
2. distinguish between the different categories and make justified decisions when to use which
56+
57+
#### Caveats
58+
59+
_This section mentions subtle points to understand, like anything resulting in
60+
implementation-defined, unspecified, or undefined behavior._
61+
62+
#### Points to cover
63+
64+
_This section lists important details for each point._
65+
66+
* a brief overview of `std::error_code` and how to use it
67+
68+
### Main: Designing APIs around `std::error_code` {#eh-main}
69+
70+
#### Background/Required Knowledge
71+
72+
* should know how to use reference parameters as an output parameter
73+
74+
#### Student outcomes
75+
76+
A student should be able to:
77+
78+
1. create an `error_code` and design API that work with `std:error_code`
79+
2. write code that utilizes `std::error_category`
80+
3. explain the difference between C-style error handling with errno and `std::error_code`
81+
4. make effective use of the interface of `std::error_code`
82+
83+
#### Caveats
84+
85+
* reset errno before calling a function that might set errno (better pass an input parameter `std::error_code`)
86+
87+
#### Points to cover
88+
89+
* provide a full picture of `std::error_code` and it’s APIs
90+
* `std::error_category` (explorative)
91+
92+
### Advanced
93+
94+
_These are important topics that are not expected to be covered but provide
95+
guidance where one can continue to investigate this topic in more depth._
96+
97+
* implementing your own `error_category`
98+
99+
[1]: error-handling/categories-of-errors.md

0 commit comments

Comments
 (0)