MISRA Discussion Forums
<cstdio> explicitly banned but not <fstream> or <ostream> - Printable Version

+- MISRA Discussion Forums (https://forum.misra.org.uk)
+-- Forum: MISRA C++ (https://forum.misra.org.uk/forumdisplay.php?fid=18)
+--- Forum: MISRA C++:2008 rules (https://forum.misra.org.uk/forumdisplay.php?fid=19)
+---- Forum: 6.27 Input/output library (C++) (https://forum.misra.org.uk/forumdisplay.php?fid=148)
+---- Thread: <cstdio> explicitly banned but not <fstream> or <ostream> (/showthread.php?tid=749)



<cstdio> explicitly banned but not <fstream> or <ostream> - KCCMITCELL - 07-07-2010

Rule 27-0-1 specifically bans the use of library for access to the external file system but not . Do we imply from this that is a safer alternative, or is it considered inherently unsafe, in any case, for application code to access the file system at run-time.

This question is asked in the context that the real-time software for our vehicle-based military project may be required to read configuration parameters from file at start-up, and log telemetry data during run-time.

It is also noted that std::cout () is used in the example code for Rule 3.4.1., whereas printf would be banned under Rule 27-0-1.


Re: <cstdio> explicitly banned but not <fstream> or <ostream - sthrjo - 21-01-2011

As I understand may be used as long as dynamic heap memory allocation is avoided (18-4-1), and the library is reliable, see "3.5 Library Issues".


Re: <cstdio> explicitly banned but not <fstream> or <ostream> - misra cpp - 11-10-2016

We agree with the post of sthrjo Fri Jan 21, 2011