3 ms·
One area where I think Ada has the edge is providing language constructs that make bare metal programming safer. Concepts like 'dangling pointers' and 'memory l
by ajxs 6y ago
One area where I think Ada has the edge is providing language constructs that make bare metal programming safer. Concepts like 'dangling pointers' and 'memory leaks' aren't relevant in a programming environment without a heap. In bare-metal programming on a microcontroller you're more likely working within a flat memory model where the 'memory safety' provided by some modern programming languages is less relevant. Arguably, this is the context within which safety-critical programming is actually happening.
- steveklabnik 6y agoYou can absolutely cause a pointer to dangle without heap allocation. Pointers can point to the stack too. You also have stuff like iterator invalidation, which is sort of a special case of a dangling pointer.
- ajxs 6y agoYou're absolutely right. Pardon me. I should have written the more specific 'use-after-free'.
- Gibbon1 6y agoI do bare metal programming. I have a macro + linker widget called stack_allocated_ptr(x) So I can write guards like if(stack_allocated_ptr(thingie)) { exit_critical_error( "oopies"); }