Hacker News new | past | comments | ask | show | jobs | submit login

> Nobody will tell you:

> stdin, stdout and stderr are artificial definitions.

Unless you RTFM.




Yea

    ~ $ man stdin | grep stdin,
           stdin, stdout, stderr - standard I/O streams
           The input stream is referred to as "standard input"; the output stream is referred to as "standard output"; and the error stream 
           is referred to as "standard error".  These terms are abbreviated to form the symbols used to refer to these files, namely stdin, stdout, and stderr.
           On program startup, the integer file descriptors associated with the streams stdin, stdout, and stderr are 0, 1, and 2, respectively.  
This alignment is, indeed, very much deliberate. Take a peek at this:

https://pubs.opengroup.org/onlinepubs/9699919799/functions/s... (also, C11)

They are optional - emphasis mine:

> three streams shall be predefined and need not be opened explicitly

They're artificial in the sense that I don't have to follow laws/rules/customs, I guess. Interesting things may or may not happen if I don't.

In the same way, interesting things happen if I wire stdout to stderr.


So you read the manual and somebody told you.


... yea I thought that was reasonably obvious. I'm posting more about the 'artificial' claim. If we had to pick sides, I'm with you.

The manuals and their tales are not ever-present or absolute, while still true.

Those descriptors do exist. They do useful things. However, there's also no significant consequence to ignoring them.

Abusing them is questionable, of course - but not guaranteed to go poorly


No need to pick sides. Manuals are a best effort by people writing code to communicate their intent. RTFM is an expression of frustration that people don't pay attention to their efforts before spouting off.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: