mirror of https://github.com/rust-lang/nomicon
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
11 lines
519 B
11 lines
519 B
8 years ago
|
# Working With Uninitialized Memory
|
||
10 years ago
|
|
||
10 years ago
|
All runtime-allocated memory in a Rust program begins its life as
|
||
|
*uninitialized*. In this state the value of the memory is an indeterminate pile
|
||
|
of bits that may or may not even reflect a valid state for the type that is
|
||
|
supposed to inhabit that location of memory. Attempting to interpret this memory
|
||
9 years ago
|
as a value of *any* type will cause Undefined Behavior. Do Not Do This.
|
||
10 years ago
|
|
||
10 years ago
|
Rust provides mechanisms to work with uninitialized memory in checked (safe) and
|
||
9 years ago
|
unchecked (unsafe) ways.
|