2. Why do we need guidelines 2.1 To develop software of high quality. The reliance on software to carry out tasks have been increasing reliably
since 1980s. There needs to be one unified way all manufacturers can follow
to make sure disasters are simply not possible. Proper software development
systems must be in-place to validate and test such software efficiently and
effectively at early stages of development where changes can be made
cheaply and easily.
MISRA, developed in mid 1990s, is one of the first set of guidelines. It is
used to produce high quality software that is easy to test and deploy, also to
reason about if changes to the system are needed in the future. It advises
avoiding the use of dangerous parts of the language in use, such as macros
in C which can have unexpected side-effects. It also has guidelines regarding
keeping the complexity of software at a minimum by following standard ways
to structure a function, standard ways to comment and document different
functionality in the code and more. Such code is maintained and debugged
more easily as certain expectations can be made that otherwise could not be.
2.2 Analysis of the software before run-time Some software tools allow the analysis of code statically without running
it. These are pivotal in detecting errors that are unlikely to happen, but
dangerous if they do happen. They often do code-flow analysis and output
parts of the code that can cause problems. Clang Static Analyzer is one of
such tools based on popular the LLVM project. It works with C, C++, and
Objective-C source code files. Other tools based on that allow refactoring of
code in a safe manner without introducing bugs.
References [1] C++20 – ISO/IEC 14882:2020 [2020]
[2] C18 – INCITS/ISO/IEC 9899:2018 [2018]