Skip to content

Commit 4091321

Browse files
authored
Adds initial topic for exception handling (#77)
resolves #15
1 parent 688e9d2 commit 4091321

File tree

5 files changed

+132
-1
lines changed

5 files changed

+132
-1
lines changed

config/spellcheck/ignored_words.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@ Hyland
2121
JC
2222
Krathwohl
2323
ness
24+
nothrow
2425
NRVO
26+
RAII
2527
req
28+
Rethrowing
2629
RVO
2730
Sattler
2831
SG

sources/knowledge_areas.dat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ EH Error Handling
5454
? ? ? ? Classes of Errors
5555
? ? ? ? errno
5656
? ? ? ? Error Codes
57-
? ? ? ? Exception Handling
57+
eh y y y Exception Handling
5858
SL Standard Library
5959
? ? ? ? Input/Output (I/O)
6060
? ? ? ? Containers, Iterators, and Algorithms
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
## Error handling: Exception handling {#eh}
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 Standards exception hierarchy
15+
16+
Main Exception guarantees
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+
Exception handling is used to be able to continue the program in case of
28+
exceptional situations (like requesting a ridiculous amount of memory:
29+
`bad_alloc`).
30+
31+
### Topic introduction
32+
33+
_Very brief introduction to the topic._
34+
35+
There are other forms of handling difficult situations, but here we concentrate
36+
on exception handling and the peculiarities/characteristics of it. Because
37+
there are different forms, we should know when to use which type of handling
38+
special situations.
39+
40+
### Foundational: Standards exception hierarchy {#eh-found}
41+
42+
#### Background/Required Knowledge
43+
44+
A student:
45+
46+
* should know about basic and user-defined types [[Type system: fundamental types]][1] [[Type system: user-defined types]][2]
47+
* should know about flow of control [???]
48+
* should know about blocks and statements [???]
49+
50+
#### Student outcomes
51+
52+
_A list of things "a student should be able to" after the curriculum._
53+
_The next word should be an action word and testable in an exam._
54+
_Max 5 items._
55+
56+
A student should be able to:
57+
58+
1. Explain how some `std::` calls may cause an exception
59+
2. Discern the different standard exception types
60+
3. Write simple try … except code (e.g., out of memory, vector at indexing)
61+
4. Explain on a “simplified” conceptual level what happens when an exception is thrown and is bubbled up through the callers until it is caught
62+
63+
64+
#### Caveats
65+
66+
_This section mentions subtle points to understand, like anything resulting in
67+
implementation-defined, unspecified, or undefined behavior._
68+
69+
* Exceptions should be used for exceptional situations and should not be used to manage normal control flow.
70+
71+
#### Points to cover
72+
73+
_This section lists important details for each point._
74+
75+
* Exception hierarchy from the standard library
76+
* Common library functions that may throw exceptions
77+
* Basic handling exceptions: try/catch/throw
78+
* How exceptions bubble up until caught
79+
80+
81+
### Main: Exception guarantees {#eh-main}
82+
83+
#### Background/Required Knowledge
84+
85+
* RAII
86+
* Order of construction/destruction of class members
87+
88+
#### Student outcomes
89+
90+
A student should be able to:
91+
92+
1. Explain the four different exception guarantees
93+
2. Explain the exception guarantees that the standard library containers offer.
94+
3. Explain what happens when a exception is thrown in constructor
95+
96+
97+
#### Caveats
98+
99+
* Make sure code is designed with RAII in mind to prevent resources leaking during exception handling, when the stack is unwound.
100+
* Care should be taken in constructor design to make all fully constructed members deleted when the stack unwinding mechanism is activated.
101+
102+
#### Points to cover
103+
104+
* Exception guarantees: Nothrow/Strong/Basic/No
105+
* Rethrowing an exception
106+
107+
### Advanced: Exception-safe containers and edge cases {#eh-advanced}
108+
109+
_These are important topics that are not expected to be covered but provide
110+
guidance where one can continue to investigate this topic in more depth._
111+
112+
* Rethrowing a modified exception
113+
* Writing exception safe containers
114+
115+
[1]: ../type-system/fundamental-types.md
116+
[2]: ../type-system/user-defined-types.md
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## Type system: Fundamental types
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+
## Types system: User-defined types
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 :)

0 commit comments

Comments
 (0)