Physical Type Tracking through Minimal Source-Code Annotation - Tom Crick (Proceedings of 14th International Workshop on Automated Verification of Critical Systems, 2014)
One of many common artefacts of complex software systems that often needs to be tracked through the entirety of the software system is the underlying type to which numerical variables refer. Commonly-used languages used in industry provide complex mechanisms through which general objects are associated to a given type: for example, the class (and template) mechanisms in Python (and C++) are extremely rich mechanisms for the construction of types with almost entirely arbitrary associated operation sets.However, one often deals with software objects that ultimately represent numerical entities corresponding to real-world measurements, even through standardised SI units: metres per second, kilogram metres per second-squared, etc. In such situations, one can be left with insufficient and ineffective type-checking: for example, the C double type will not prevent the erroneous addition of values representing velocity (with SI units metre per second) to values representing mass (SI unit kilogram).We present an addition to the C language, defined through the existing attribute mechanism, that allows automatic control of physical types at compile-time; the only requirement is that individual variables be identified at declaration time with appropriate SI (or similar) units.