← Back to context

Comment by sirwhinesalot

3 years ago

You can, but it's not like the Rust std-lib is in that style, nor does it play well with the ownership semantics, so my point stands.

You can also write literal C and use the C std-lib in C++ but it is the same problem. You're not using C++ at that point

You can use every rust API in that style, even if it wasn't written like that. See the sibling comment here: https://news.ycombinator.com/item?id=30472226

  • If you think what we're talking about amounts to having a . or not then you have no idea what we're talking about.

    Rust's stdlib assumes not only that there is malloc behind the scenes, but that it is ok to panic. Rust itself, including its stdlib, lacks a stable ABI. It also assumes that lots of little allocations and deallocations with a single owner is a valid memory pattern, and that writing directly to specific memory locations is something you never want to do. These are all wrong assumptions for someone writing baremetal. Look up abi_stable and no_std.

    • Obviously for embedded use cases you’d not want to use std. it’s why we have core. If you want a stable ABI, you can also easily offer a repr(C) interface. I don’t know what to tell you, plenty of people use Rust successfully for embedded programming.

      1 reply →