The MISRA-C Guidelines recognise that, in some situations, it is unreasonable or even impossible to comply with a coding rule and that it is necessary to deviate. Your example of casting an integer to a pointer is a situation where a deviation would be reasonable.
It is important that such deviations are properly recorded and authorized. The deviation procedure should be formalized within the software development process. No process is imposed by MISRA C because methods used will vary between organizations, for example:
* The physical methods used to raise, review and approve a deviation;
* The degree of review and evidence required, which may vary according to the guideline in question, before a deviation can be approved.
A deviation record should include:
* The guideline being deviated;
* The circumstances in which the deviation is permitted;
* Justification for the deviation, including an assessment of the risks associating with deviating compared with other possibilities;
* Demonstration of how safety is assured, for example a proof that an unsafe condition cannot occur, together with any additional reviews or tests that are required;
* Potential consequences of the deviation and any mitigating actions that have been taken.
A worked example of a deviation is given in Appendix I of the MISRA C:2012 guidelines.