One thing I would like for c++ and freestanding would maybe be levels of freestanding. In freestanding C you turn on your hardware, set the stack pointer, zero out .bss and you are ready for C main(). Freestanding c++ is a lot more involved with features most users of freestanding don't want (exceptions, rtti). So I would love to have maybe level0: no new/delete, just constructor calls, alloca, really just bare hardware. level1: memory management (new, delete, malloc, free, allocators). And then it gets kind of gooey: level2a: exceptions+rtti and level2b threads. It becomes more of a feature tree. Libraries and Users can then pick a Node in the tree and use everything below. I would also love some way for new/constructors to fail without exceptions.
@shawnshaw98592 жыл бұрын
or, just provide the rust-alike no-std option with a subset library called libcore, so I can use c++ for OS and firmware development.
@bigboysteen76383 жыл бұрын
99% of the c++ standard library is inline templated stuff, like std::move or std::array, yet free standing can't have those things why? they do not require an operating system, they do not require linking to a library, so why aren't they accessible to freestanding? this sounds extremely foolish to me and since new is actually required by the standard, we could even have most containers. so c++ requires freestanding to have exception handling and rtti, but it can't provide std::array, what a bad language
@goswinvonbrederlow66022 жыл бұрын
I'm doing embedded work with c++ and when you start with some hardware you don't have new, you turn of exceptions and rtti because you have no code to set that up and it is complicated to do. And then start programming. 99% of the c++ standard library are right out the window at that point. You eventually implement malloc/free/new/delete but quite often you never want exceptions and rtti. And that is kind of the target audience for freestanding I feel. If you want 99% of the standard library then just link against a standard library. Freestanding doesn't mean you can't have an STL. Freestanding is where you start from to implement an STL so I think it already has too much, or rather the wrong things.