3 ms·
Oh, in C/C++. Title should say that. In Rust, you just use no_std for small embedded work.
by Animats 4y ago
Oh, in C/C++. Title should say that.
In Rust, you just use no_std for small embedded work.
- 3a2d29 4y agoDoesn’t the compiler do some hidden allocations? And as a follow up, why use rust if allocations mean ownership rules are no longer needed?
- SAI_Peregrinus 4y agoRust with no_std (and without the Alloc crate) won't do any hidden heap allocations. There's no allocator at all in such an environment! There is still a stack, and there are still static allocations. And of course you can still allocate statically in your linker script. Ownership still matters, because nothing about ownership cares about heap allocation vs stack allocation.
- abraxas 4y agoThanks for clarifying this. My dabbling in Rust a few years ago ended when I could not find a satisfying answer to the question "how do I prevent any unwanted dynamic allocations in this language?". At the time I found no good answers and gave up on trying to learn the language as that was not the kind of thing I was willing to relinquish to the wisdom of the compiler.
- deleted 4y ago[deleted]
- deleted 4y ago[deleted]
- sarahsbasar 4y agoAnd in C you use -ffreestanding/nostdlib The problem was how to make sure 3rd party libraries don't allocate.
- pjmlp 4y agoIn Ada one uses the Ravenscar profile.