Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

And here I thought you were talking about the first example in the blog:

    fmt.Println("Hello, world")
Now what happens when program opens a file and is run without stdout:

    ./program >&-
The file it opens is fd 1 and the program prints to the file instead of printing to the console. An odd case that has caused security holes in the past. In languages that fail on errors if they print anything before opening the file then they don't corrupt the file.

The default and laziest case for errors should never be to just hide them and continue on.



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

Search: