Mode:
Duration:
1
Coding works best on desktop or with an external keyboard.
Coding works best on desktop or with an external keyboard.
A SPARK Ada function that sums all elements of an integer array.
function Array_Sum(Arr : array (Positive range <>) of Integer) return Integer is
Sum : Integer := 0;
begin
for I in Arr'Range loop
Sum := Sum + Arr(I);
end loop;
return Sum;
end Array_Sum;SPARK is a formally verifiable subset of the Ada programming language designed for high-integrity and safety-critical systems. It enforces strong typing, design-by-contract, and static analysis to mathematically prove program correctness and eliminate entire classes of bugs.
Origin & Creator
Developed by Praxis (now Altran UK) and later extended by AdaCore, leading vendors of Ada technology for mission- and safety-critical software.
Industrial Note
SPARK is used where DO-178C Level A or IEC 61508 SIL-4 compliance is required, enabling mathematical proof of correctness for safety-critical and security-critical applications.