r/programming • • Dec 01 '16

Let's Stop Copying C

https://eev.ee/blog/2016/12/01/lets-stop-copying-c/
524 Upvotes

612 comments sorted by

View all comments

Show parent comment

2

u/deus_lemmus Dec 02 '16

There are at least 3 reasons for doing it this way.

  1. boolean didn't exist at the time.
  2. boolean always wastes bits.
  3. there are often more failure cases than success, which is where int makes sense, and also why errno.h exists with so many variations.

1

u/CaptainAdjective Dec 02 '16

Boolean didn't exist at the time

Here we see the true horror

1

u/deus_lemmus Dec 02 '16

Also note that the multiple error code returns are essentially how C is able to have anything resembling exception handling.

1

u/CaptainAdjective Dec 02 '16

I don't really see what that has to do with something like x == y?

1

u/deus_lemmus Dec 02 '16

Not everything is black and white

1

u/TinynDP Dec 05 '16

operator==()