They explain it there: "No RTTI, memory allocation, nor exceptions."
Basically, nothing that has significant "runtime" cost....dynamic_cast, new/malloc, throwing exceptions.
They explain it there: "No RTTI, memory allocation, nor exceptions."
Basically, nothing that has significant "runtime" cost....dynamic_cast, new/malloc, throwing exceptions.
In C++ this makes less sense because their standard library does have a defined "freestanding" subset but it doesn't make a very coherent whole, it's roughly the bits that seemed obviously to just not need any other components to work. It changes from version to version. And this stx library replaces what you might think of as core ideas, like an optional type, so you don't keep the shared vocabulary benefit.
[Edited to correct "standalone" to "freestanding"]
This is a bit misleading. It's easier to provide mutual exclusion on bare hardware than in an OS; just do a spinlock, except with modern ISAs the core doesn't even spin.
Presumably core doesn't offer this because it's a massive footgun for devs new to multithreading who would not understand why this is unacceptable to use in an OS-hosted process.
Although tricks like PAUSE are much cheaper than a naive spinlock, they are still spinning as I understand it, just not as frantically because that's pointless and wasteful.
I'm talking about wfi, wfe, and friends.
I'd always assumed rust may have taken this from C compiler arguments like -nostdlib / -nostdinc (and corresponding C++ ones -nostdlib++, -nostdinc++).