+ 3

Stdio.h source code

I was looking through the stdio.h file to understand what my computer is actually doing when I call printf. I do not understand the: __mingw_stdio_redirect__ int printf(const char *__format, ...) { ... } The top part that says __mingw_stdio_redirect__ I do not understand. What does this do? I have never even seen code written like this. It is code that just goes over my head.

9th Jun 2018, 8:48 AM
Fabio Rocha
Fabio Rocha - avatar
6 Answers
+ 4
9th Jun 2018, 9:06 AM
Hatsy Rei
Hatsy Rei - avatar
+ 6
It is a macro. That is the most I can tell. A few lines earlier: #undef __mingw_stdio_redirect__ #define __mingw_stdio_redirect__(F) __cdecl __MINGW_NOTHROW __mingw_##F
9th Jun 2018, 9:04 AM
Hatsy Rei
Hatsy Rei - avatar
+ 5
Honestly though, if you are not planning to write libraries, these details should not pertain to you (i.e. You can be a good programmer without being able to explain stdio's innards). It's good to get to know the contents, but don't stress yourself over this.
9th Jun 2018, 9:11 AM
Hatsy Rei
Hatsy Rei - avatar
+ 2
I see, so what does it really do to the code in general? What is its purpose?
9th Jun 2018, 9:05 AM
Fabio Rocha
Fabio Rocha - avatar
+ 2
Ok, thank you very much. That goes to show how much more there is to learn in C/C++.
9th Jun 2018, 9:08 AM
Fabio Rocha
Fabio Rocha - avatar
+ 2
Well that is a relief. I guess I will just take my time in learning those. Thank you again.
9th Jun 2018, 9:12 AM
Fabio Rocha
Fabio Rocha - avatar