MS Visual Studio 2017, new Windows Console Application project from VisualC++ category. The default stdafx.h header includes the following lines:
#include <stdio.h>
#include <tchar.h>
And below them:
// TODO: reference additional headers your program requires here
Because this comment is put below, not above #include <stdio.h>, I am inclined to believe that stdio.h is included by default not as a convenience for the user who would probably #include it anyway, but is for some reason required? The fact that stdio.h is included rather than cstdio only seems to support this interpretation?
AM I right? Can I safely remove #include <stdio.h>? I'm asking because the very first line in my main function reads:
std::ios_base::sync_with_stdio(false);
Which is obviously incorrect if facilities from stdio are being used anyway, as this header being included would suggest.
1) Can I safely remove the line that says #include <stdio.h> from stdafx.h?
2) Can I safely call std::ios_base::sync_with_stdio(false)?
3) Is the fact that tchar.h is also included by default relevant here?
Yes you can remove it.
You can even name your precompiled header not stdafx.h, or disable percompiled header at all.
It is just convenience and example to start with.