2 ms·
> Ada only has use-after-free if unchecked deallocation is used You mean if you just never deallocate? Or is there a third option? Genuine question; I don't fo
by IshKebab 1y ago
> Ada only has use-after-free if unchecked deallocation is used
You mean if you just never deallocate? Or is there a third option? Genuine question; I don't follow Ada closely.
> If anything we will only get more foundational software in safer languages, when the generation that only accepts C and C++ for specific domains is no longer among us.
I'm more optimistic - the Rust in Linux people are making progress and that's probably the thickest den of naysayers. Uutils is actually being used in Ubuntu (and sudo-rs I think?).
It'll probably take a long time until Rust outweighs C but I think we're talking 10-20 years not 30-40.
- pjmlp 1y agoIn practice, Unchecked_Deallocation should be used as much as unsafe in Rust. Ada provides a series of features towards that goal. First one, already present in Ada 83, is that stack allocation is dynamic, a bit like C99 VLAs, with the differenc that it is bounds checked and and exception is thrown if there is not enough space, instead of corrupting the stack. Also Ada pointers (access types), have some type constraints, so already with that one can make some kind of arena like storage that doesn't depend on using pointers all over the place. Ada 95 introduced controlled types, which is basically RAII in Ada, providing yet another way not to use Unchecked_Deallocation directly on "userspace" code. Ada 2005 introduced bounded and unbounded container types, further extended and improved in later versions, which allow to write many algorithms and data structures that build upon them, without having to go into low level memory allocation approaches. With Ada 2012 formal proofs, coupled with SPARK 2014 tooling, you can additionally ensure specific conditions are met before doing whatever with specific resources, including ownership.