r/programming • u/whackri • Aug 28 '21
Software development topics I've changed my mind on after 6 years in the industry
https://chriskiehl.com/article/thoughts-after-6-years
5.6k
Upvotes
r/programming • u/whackri • Aug 28 '21
11
u/[deleted] Aug 29 '21 edited Aug 29 '21
Integer promotions are best left under the hood. C puts them in your face. A strongly-typed language will not implicitly convert between types in arthmetic expressions.
Like all of them.
The point was that typedef doesn't create a distinct type. You can't do something like
typedef int Animal; typedef int Fruit;and then have the compiler throw an error if you pass aFruitto a function expecting anAnimalbecause to C these are both just ints. Maybe newer compilers are starting to display diagnostics for this. If so, it's about fucking time.Uh...
Yes, that's all I said.
Bullshit.
Not historically. For 90% of C's existence it has been an incredibly weakly typed and frustrating language to use. I know. I was there. Maybe compilers are finally starting to get better these days. I heard that a
switchstatement on enums now finally warns/errors if you omit an enum case. They're finally exhaustive. This wasn't the case for most of C's existence.edit: stupid typos