8
metamourge
214d

Why do io-interfaces usually use a signed integer to return the number of bytes processed?
Like seriously, you literally can't write/read less than 0 bytes.

Comments
  • 7
    I imagine because most programs/libraries use normal ints and casting them constantly sucks. I'm told that's also the reason why so few programs use uints anywhere
  • 8
    negative numbers indicate errors in C.
  • 2
    First, precisely because you can use negative numbers for different errors. Second, because unsigned integers propagate in integer expressions while signed ones don't.
  • 1
    Negative numbers denote errors in most cases.
Add Comment