Results for “Dynamic memory & ownership”
Small, practical examples. Search by task or narrow things down below.
Read 16-bit values from a flash table
Arduino / C: pgm_read_word retrieves a complete word from program memory.
Arduino / C✓ Tested
Read a byte lookup table from flash
Arduino / C: PROGMEM tables require the AVR program-memory access functions.
Arduino / C✓ Tested
Read a channel until all senders close
Read a channel until all senders close in a complete Rust program using the standard library.
Rust✓ Tested
Read a variant only when it holds the expected type
C++: get_if returns a null pointer rather than throwing for another active alternative.
C++✓ Tested
Read and total a flash lookup table
Arduino / C: Array size can be computed at compile time even for a flash-resident table.
Arduino / C✓ Tested
Reject an unsupported settings version
Arduino / C: A version byte lets firmware fall back when stored settings use another format.
Arduino / C✓ Tested
Represent an absent result with optional
C++: value_or supplies a default without requiring a sentinel inside the value domain.
C++✓ Tested
Run cleanup through a scoped destructor
C++: A stack object’s destructor runs when its scope exits, including normal exception unwinding.
C++✓ Tested
Send a value through a channel
Send a value through a channel in a complete Rust program using the standard library.
Rust✓ Tested
Share immutable data with Arc
Share immutable data with Arc in a complete Rust program using the standard library.
Rust✓ Tested
Store a bounded null-terminated text setting
Arduino / C: Write a fixed buffer and explicitly terminate the retrieved copy.
Arduino / C✓ Tested
Store a compact configuration record
Arduino / C: Save a struct and retrieve it with the same field layout.
Arduino / C✓ Tested