rust/uninitialized.md

10 lines
519 B
Markdown
Raw Normal View History

2015-06-08 11:41:58 -05:00
% Working With Uninitialized Memory
2015-06-25 11:46:59 -05:00
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
as a value of *any* type will cause Undefined Behaviour. Do Not Do This.
2015-06-08 11:41:58 -05:00
2015-07-06 20:36:16 -05:00
Rust provides mechanisms to work with uninitialized memory in checked (safe) and
unchecked (unsafe) ways.