MISRA Discussion Forums

Full Version: Rule 20.9
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Rule 20.9 says that the input/output library shall not be used in production code.

We can not use the function open because is not ANSI C. Which would be the alternative to open a file instead of fopen?

Thanks.
You must avoid undefined behaviour, you must not rely on unspecified behaviour, and you must document implementation defined behaviour.

Many library functions contain instances of such behaviour. Where possible, additional measures should be used to avoid the risk of reliance on such behaviour. Deviations should document such use.

fopen() could be used with an appropriate deviation to rule 20.9.
open() could be used with an appropriate deviation to rule 3.6.