Rule 20.9 - Printable Version +- MISRA Discussion Forums (https://forum.misra.org.uk) +-- Forum: MISRA C (https://forum.misra.org.uk/forumdisplay.php?fid=4) +--- Forum: MISRA-C: 2004 rules (https://forum.misra.org.uk/forumdisplay.php?fid=17) +---- Forum: 6.20 Standard Libraries (https://forum.misra.org.uk/forumdisplay.php?fid=42) +---- Thread: Rule 20.9 (/showthread.php?tid=220) |
Rule 20.9 - Nuria - 21-02-2006 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. - misra-c - 27-04-2006 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. |