2 ms·
I believe there was a comment here recently about someone writing software for airplanes, mentioning how after power up, and when the plane was in the air, no n
by e12e 10y ago
I believe there was a comment here recently about someone writing software for airplanes, mentioning how after power up, and when the plane was in the air, no new allocations were allowed. So it's not unheard of.
Speaking of safe software, I came across a free chapter/snippet on memory and safety in Ada[1]:
"(...)Restrictions
There is a general mechanism for ensuring that we do not use certain features of
the language and that is the pragma Restrictions. Thus if we write
pragma Restrictions(No_Dependence =>
Unchecked_Deallocation);
then we are asserting that the program does not use
Unchecked_Deallocation at all – the compiler will reject the program if this is not true.
There are over forty such restrictions in Ada 2005 which can be used to give assurance about various aspects of the program. Many are rather specialized and relate to multitasking programs. Others which concern storage generally and are thus relevant to this chapter are
pragma Restrictions(No_Allocators);
pragma Restrictions(No_Implicit_Heap_Allocations);
The first completely prevents the use of the allocator
new as in new Cell'( ... ) and thus all explicit use of the heap. Just occasionally some implementations might use the heap temporarily for objects in certain awkward circumstances. This is rare and can be prevented by the second pragma.
Hint: Ada is also a high level language that allows low-level programming, and might be fun for writing a lisp ;-)
[1] http://www.adacore.com/adaanswers/gems/gem-43-safe-and-secure-software-chapter-7-safe-memory-management/ http://www.adacore.com/adaanswers/gems/gem-43-safe-and-secur...
- junke 10y agoSee for example Structured Programming with Limited Private Types in Ada: Nesting is for the Soaring Eagles, by Henry G. Baker. (http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.39.625&rep=rep1&type=pdf http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.39....)