Hacker News new | ask | show | jobs
by ben336 4314 days ago
> If you don't understand how to use sharp tools, you may hurt yourself and others.

It's still bad API design when naively handling an error case kills everything. Is there an inherent reason that the error value for a pid has to be the same as the "all pids" value? Unless there's a very compelling reason, it seems like very poor design, well documented or not.

1 comments

The inherent reason is that -1 is the most common error return code in C based APIs. The problem is not naively handling an error case, it's not handling an error case. Using a different value might avoid calling killall -1, but the program would still be incorrect.

This is the same sort of argument as strlcat vs strncat, and people can't agree on that one.