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

Some newer POSIX APIs, such as pthreads, do return the error this way. But many legacy APIs, such as dup or read, use the positive integer space, thus the negation pattern you often see in syscalls. Notably, POSIX guarantees <errno.h> values to be positive integers.


`dup` and `read` returns -1 on error and set the `errno` variable. If they were redesigned, they should just return `-errno` on failure.




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

Search: