Rust for C++

Memory Zones

Static

Rust
fn main() {
    static STATIC_BLOCK: Block = Block{number:0};
}

Run

C++
int main() {
    static Block static_block;
}

Run

Stack

Rust
fn main() {
    let stack_block = Block{number:0};
}

Run

C++
int main() {
    Block stack_block;
}

Run

Heap

Rust
fn main() {
    let heap_block = Box::new(Block{number:0});
}

Run

C++
int main() {
    Block* heap_block = new Block();
}

Run