4 ms·
Some languages have this already. Specifically safety critical languages like Ada. Ever so slowly the entire industry is moving towards what ada had in 1983. Be
by spitfire 16y ago
Some languages have this already. Specifically safety critical languages like Ada. Ever so slowly the entire industry is moving towards what ada had in 1983. Beyond
this you can use the spark annotations on top of ada to verify code does what it's expected to.
Here's some Ada range examples
type My_Int is range 1..100;
type byte is mod 28;
type Sin_Values is digits 10
range -1.0..1.0;
Then you can query the object for its range:
z'range;
or see if it's even valid, useful for finding stray bits switched by cosmic rays - I'm serious here.
if z'valid then
dowhatever;
else
printwarning;