Skip to content

define (un)sound and UB #190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 27, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions reference/src/glossary.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@ Moreover, such unsafe code must not return a non-UTF-8 string to the "outside" o
To summarize: *Data must always be valid, but it only must be safe in safe code.*
For some more information, see [this blog post](https://www.ralfj.de/blog/2018/08/22/two-kinds-of-invariants.html).

#### Soundness (of code / of a library)

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.
Conversely, the library is *unsound* if safe code *can* cause Undefined Behavior.

#### Layout

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).
Expand Down