Does iostream includes functions of cstdio?

后端 未结 1 1490
野趣味
野趣味 2020-12-18 14:21

I use Dev C++ 5.11. TDM-GCC 4.8.1

And this code runs well.

#include
using namespace std;

int main()
{
printf(\"%d\\n\", 42);
cout &l         


        
相关标签:
1条回答
  • 2020-12-18 14:51

    The list of header files included in a system/standard header file is library implementation dependent (that is usually associated with the compiler you're using), and (as far as I remember) the C++ standard does not prohibit one header file from automatically including another one

    In your case <iostream> is probably also #including <stdio.h> (or <cstdio>).

    Relying on a header file being included in another is non portable to different standard libraries, compilers and platforms, so it's better to make sure that you explicitly #include everything you need.

    0 讨论(0)
提交回复
热议问题