Assuming I have the code snippet like this:
#include <iostream>
using namespace std;
int main(int argc, char *argv[]) {
printf("%d",5);
}
It compiles and runs normally on my Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn) compiler, however it fails on gcc version 4.4.5 (Debian 4.4.5-8), saying it doesn't recognize "printf" function. Professors at my Uni use the latter and today they said that my program doesn't work.
My question is - why does clang (run by g++ namefile.cpp on OS X 10.9) include "cstdio.h" automatically in this case?
PS. I am aware there are cin and cout streams in C++, and that would solve the problem, but my question is more theoretical and for future purposes of automatic includes.