Got bored and opened /usr/include/stdio.h to see if I can learn something from it.

But what I found... I now cannot unsee...

This whole time... it was all an illusion...
Life will never be the same again.

  • 0
    so basically they are all the same? Just given different name to make them happy?
  • 8
    @gitpush Not quite. stdin, stdout and stderr are three different data structures, defined in an external source file (hence the "extern" keyword). The problem was that they are not macros.
    Macros instruct the compiler to replace every X in the code with Y before compiling.
    "#define LEN 40" means "replace LEN with 40", and "#define stdin stdin" means "replace stdin with stdin"... which does nothing.
    So now they technically are macros, just useless ones.
  • 2
    @PaperBag oh now I understand, I'm not a C/C++ dev so don't really know, thanks for clearing it up
  • 0
    C is shit, cpp is good. Understand why, now?
Add Comment