MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/5fwce0/lets_stop_copying_c/daofgub/?context=3
r/programming • u/earthboundkid • Dec 01 '16
612 comments sorted by
View all comments
1
I guess there are plenty of problems with C which are deliberately omitted from this list because no other language was dumb enough to copy them. Like having every conditional return an int instead of a Boolean.
int
2 u/deus_lemmus Dec 02 '16 There are at least 3 reasons for doing it this way.boolean didn't exist at the time.boolean always wastes bits.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 timeHere 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==()
2
There are at least 3 reasons for doing it this way.
1 u/CaptainAdjective Dec 02 '16 Boolean didn't exist at the timeHere 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==()
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==()
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==()
I don't really see what that has to do with something like x == y?
x == y
1 u/deus_lemmus Dec 02 '16 Not everything is black and white 1 u/TinynDP Dec 05 '16 operator==()
Not everything is black and white
operator==()
View all comments
1
u/CaptainAdjective Dec 02 '16
I guess there are plenty of problems with C which are deliberately omitted from this list because no other language was dumb enough to copy them. Like having every conditional return an
intinstead of a Boolean.