Skip to content

Commit c773633

Browse files
vulderjcvwBogCyg
authored
Adds initial draft for run-time error debugging topic (#89)
resolves #22 Co-authored-by: JC van Winkel <[email protected]> Co-authored-by: Bogusław Cyganek <[email protected]>
1 parent 9a78863 commit c773633

File tree

3 files changed

+121
-0
lines changed

3 files changed

+121
-0
lines changed

sources/knowledge_areas.dat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ EH Error Handling
5656
? ? ? ? Error Codes
5757
eh y y y Exception Handling
5858
DE Debugging Errors
59+
compiletimeerr y y y Compile-Time Errors
5960
runtimeerr y y y Run-time Errors
6061
SL Standard Library
6162
? ? ? ? Input/Output (I/O)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## Debugging Errors: Build errors
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+
## Debugging Errors: Compile-time errors {#compiletimeerr}
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 Understanding elementary error messages
15+
16+
Main Dealing with most error messages
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+
Compiler error messages can be hard to read and even compiler specific.
28+
However, they contain valuable information for determining the cause of the compile-time errors.
29+
Oftentimes the error messages are very verbose to give you the most precise information about the error context, so learning how to extract the valuable information from the error message is an important skill that one should acquire.
30+
31+
### Topic introduction
32+
33+
_Very brief introduction to the topic._
34+
35+
C++ compilers try to statically determine errors at compile time to shift detection of problems that would occur later on (e.g., at link time or run time) to earlier point in time, where they can be addressed in an earlier stage of the development process.
36+
The error message that the compiler generates directly relates to the C++ language definition and precisely lays out why the code is not valid and where it does not comply with the language rules.
37+
38+
### Foundational: Understanding elementary error messages {#compiletimeerr-found}
39+
40+
#### Background/Required Knowledge
41+
42+
A student:
43+
44+
* definitions [[C++ Object Model: Definitions - Foundational]][1]
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. distill the core of an elementary error message.
55+
2. act on elementary error messages.
56+
3. differentiate between different error kinds (e.g., type errors, syntax errors, ...).
57+
4. give examples for different kinds of errors.
58+
59+
60+
#### Caveats
61+
62+
_This section mentions subtle points to understand, like anything resulting in
63+
implementation-defined, unspecified, or undefined behavior._
64+
65+
* names mentioned in error message are presented in full detail and may not look exactly like specified by the programmer (e.g., `std::string` -> `std::basic_string<char>`)
66+
67+
#### Points to cover
68+
69+
_This section lists important details for each point._
70+
71+
* methodology of reading error messages
72+
* start with the first error
73+
* read top down
74+
* parse error message / pattern matching to error kinds
75+
* linker errors [[Debugging Errors: Build errors - Foundational]][2]
76+
77+
78+
### Main: Dealing with most error messages {#compiletimeerr-main}
79+
80+
#### Background/Required Knowledge
81+
82+
* compile-time programming [Soft dependency]
83+
84+
#### Student outcomes
85+
86+
A student should be able to:
87+
88+
1. locate the principle template involved in a template error message.
89+
2. determine why a specific overload is chosen, from the compiler’s error message.
90+
3. apply common debugging techniques in a constexpr context.
91+
92+
#### Caveats
93+
94+
* argument dependent lookup
95+
* there is currently no good debugger support for constexpr context
96+
97+
#### Points to cover
98+
99+
* templates related error messages
100+
* overload resolution related errors
101+
* reasoning about errors during constexpr execution (consteval)
102+
* reverting to non-constexpr run-time debugging
103+
* employing static_assert
104+
105+
### Advanced
106+
107+
_These are important topics that are not expected to be covered but provide
108+
guidance where one can continue to investigate this topic in more depth._
109+
110+
* Full error analysis, there are error messages that are out of the scope for students.
111+
* Complicated SFINAE constructs
112+
113+
[1]: ../object-model/definitions.md
114+
[2]: ../debugging-errors/build-errors.md

0 commit comments

Comments
 (0)