3 ms·
In my experience it's much harder to write Python that won't crash than C/C++ that won't crash. With Python, rarely taken code paths can have very dumb errors i
by cozzyd 4y ago
In my experience it's much harder to write Python that won't crash than C/C++ that won't crash. With Python, rarely taken code paths can have very dumb errors in them (e.g. accidentally introducing a new variable with a different name than the variable you wanted or typoing a method name, or passing arguments with the wrong type) that would get caught by a C/C++ compiler but won't be caught in Python until the crash happens some months later. Typically in "reliable" code you're not going to do much dynamic allocation anyway, at least past the initialization stage (because memory fragmentation!) so memory errors aren't that common anyway.
Yes, probably Rust and Ada provide even more guarantees...
- snicker7 4y agoC/C++ memory errors are literally responsible for 70% of ALL critical security bugs. Most python "dumb errors" can be caught by linters. Memory is infinitely harder. Source -- https://msrc-blog.microsoft.com/2019/07/16/a-proactive-approach-to-more-secure-code/ https://msrc-blog.microsoft.com/2019/07/16/a-proactive-appro...
- buescher 4y agoAnd Python is implemented as a large C program.
- mirekrusin 4y ago66% python, 32% C - for cpython. 94% python, 5% C - for pypy.
- buescher 4y agocpython is the reference implementation and 32% means about 350,000 lines of code. My point stands.
- mirekrusin 4y agoSo is glasgow haskell compiler or ocaml compiler - so what?
- cozzyd 4y agoThe linter can't tell that the method doesn't exist until runtime, can it? If so, it wouldn't accept lots of valid python... Also, what linter should I use? Either way, not all software needs to be secure to an adversary (since it's running behind several firewalls and if the attacker has shell access, then it's already game over).