MISRA-C ( Motor Industry Software Reliability Association ) v 1.0 is set of rules or guidelines for how to use C Language in vehicle or automotive industry software and includes safety integrity level 3. In 1998 first version was released.
It also explains the reason why MISRA-C guidelines is required and talks about how programmers should use in development of software. It explains about C language issues and apart from that for reliability of code what needs to be done so developer can says they have followed "standard practice" for development of code.
In any programming languages there is no assurance that whatever programmer wanted to do code will executes exactly the same. There is always some minor issues/bugs/errors/overflow arises which creates always some runtime or compile time issue which developers can't predict or see at first place which are listed below:
1. Developers always do mistakes in writing code.C have various style and expression which can be used to write neat and clean and user understandable code and it also can be used for either way and in which it can be hard to understand code what is it used for. Such writing practice is not good for safety critical system software applications. Syntax of C can also cause errors. C also weak in "type checking" of any variable type like forcefully store float into int for compatibility which is wrong and will not raise error.
2. Operator precedence is easy to misunderstands by developer. There are many areas where developer can be easily misread the operator and can cause issues.
3. Compiler doesn't always do what is expected to be asked by developers. C language have some features which are ambiguous and can be behaves bit differently and it varies from compiler to compiler specially when developer wants to port code from one compiler to another here at least C standard list that issues so developer can know it.
4. Even compilers can have errors itself. Because compiler itself is a software tool and may not necessary it always compiles the code correctly in certain situations and could have some bugs. Reason behind is that C standards can be misunderstand by compiler writers and so write wrong way. Sometimes compiler writers chooses to write code different from standard in some areas of language which is prone to errors.
5. Well known run time errors. C language doesn't provide runtime errors like arithmetic exceptions like divide by zero, buffer overflow, valid address for pointers, and array boundary overflow errors.
Use of C language in design of safety critical applications.
From above sections explained issues in C programming care must be taken to design system in which safety is a highest priority. However C is widely used and mature enough to be used because there is many commercially available testing tool available to statically analyse and detect errors as explained above. But in case if somebody want to use better than C language in safety critical application there is two such language is available name is Ada and Modula 2. While Assembly language is worse than C for Safety critical application and if one wants to use it need to adhere strict guidelines.
To be continued...