FFS stop using C.
Conversation
Replying to
Mad respect, but I also ask, what is wrong with C? Can't you get in equal amounts of trouble in other languages that expose pointers? #JustCurious
1
1
Replying to
You can! For instance if this was written in unsafe Rust I'd be complaining as well. But the lesson there is that a bech32 implementation doesn't need to be written in unsafe Rust; use safe Rust instead.
1
4
There are cases where you don't have a choice - I've written a lot of unsafe Rust myself. But bech32 implementations don't need to do anything low level, and there's no need to squeeze the last % of performance out (there might even be no difference in performance).
1
1
3
The problem is pointers and languages that rely on them. It's just too easy to screw up code that uses them, and we have better alternatives now like Rust's reference system.
1
2
What do you think about languages that try to be secure beyond memory safety (I am mostly thinking on functional languages like OCaml)to write this kind of security critacal code?
1
Rust certainly is one. It's not just a memory safe low-level language. It has a modern type system with algebraic data types, type classes usable for both generics and as objects, etc. The ownership / borrowing systems for memory safety catch many non-memory-safety problems too.
1
1
3
The system preventing use-after-free and other memory corruption bugs prevents issues like iterator invalidation or using a file after it's closed still present in a modern garbage collected languages. It also prevents data races between threads (not race conditions as a whole).




