Skip to content

Commit 160e361

Browse files
committed
define (un)sound
1 parent f3781c2 commit 160e361

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Diff for: reference/src/glossary.md

+5
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,11 @@ Moreover, such unsafe code must not return a non-UTF-8 string to the "outside" o
146146
To summarize: *Data must always be valid, but it only must be safe in safe code.*
147147
For some more information, see [this blog post](https://www.ralfj.de/blog/2018/08/22/two-kinds-of-invariants.html).
148148

149+
#### Soundness (of code / of a library)
150+
151+
We say that a library (can be an individual function) is *sound* if it is impossible for safe code to cause Undefined Behavior using its public API.
152+
Conversely, the library is *unsound* if safe code *can* cause Undefined Behavior.
153+
149154
#### Layout
150155

151156
The *layout* of a type defines its size and alignment as well as the offsets of its subobjects (e.g. fields of structs/unions/enum/... or elements of arrays).

0 commit comments

Comments
 (0)