3 ms·
I'm not here to bash C, okay maybe a smidge, but yes other languages do have gotchas and weird ugly creepies. Some of the ones that scare me... The '-->' nono
by thumbuddy 3y ago
I'm not here to bash C, okay maybe a smidge, but yes other languages do have gotchas and weird ugly creepies. Some of the ones that scare me...
The '-->' nonoperator.
Defining structs in a function declaration gives me the creeps. Same goes for the nested struct definition interpretation like come on.
Void pointers in general stress me out. That's one I knew about before reading this. Makes bookkeeping hard.
I get that C is basically sugar around ASM. I have respect for it. At the same time, it feels so hazardous to write. Everytime I think I know enough I stumble on some weird UB landmine, or find some bizarre library that despite understanding 99% of the code the remaining 1% conceals everything I care about.
The quirks in many other languages can be rough, but I feel like Cs leave developers in a scarier place given the risk factors
- lelanthran 3y ago> The '-->' nonoperator. it's the same in most languages. Works identically in Java, for example: https://www.jdoodle.com/iembed/v0/JL5 https://www.jdoodle.com/iembed/v0/JL5 See? > Defining structs in a function declaration gives me the creeps. Both Kotlin and Go allow defining classes anywhere - they're anonymous. > Same goes for the nested struct definition interpretation like come on. Come on ... what? That's not a footgun. Because C is strongly typed, anytime you do a nested definition and expect it to be in the scope of the parent struct, you'll get an error if you try to create a new struct with the same name. > Void pointers in general stress me out. Fair enough, casting to and from void pointers explicitly throws away the type information. > The quirks in many other languages can be rough, but I feel like Cs leave developers in a scarier place given the risk factors The two quirks you complained about here are in other languages. While C has problems, there is not much in this list that is problematic.