3 ms·
Unsafe is not a problem in my experience. The same way a kernel might have some part written in asm (for freebsd it's like 1% I believe) your rust code will hav
by adamnemecek 6y ago
Unsafe is not a problem in my experience. The same way a kernel might have some part written in asm (for freebsd it's like 1% I believe) your rust code will have 1% of Unsafe code. Might be more depending on what you are doing. However the same way few bugs happen in the asm code of a kernel, your unsafe will not have many bugs.
- saagarjha 6y agoActually, a lot of bugs happen in the assembly part of the kernel. Processors are hard ;)
- loeg 6y agoDo you have a source for that claim?
- saagarjha 6y agoA couple examples off the top of my head: all the recent speculative execution stuff, OpenBSD's buggy SMAP implementation, some recent bugs ARM's PAN.
- adamnemecek 6y agoOK thats how many 10? How many are not asm bugs? Like it's not many considering the total number of bugs.
- loeg 6y agoYou specifically responded to a claim that there were relatively few assembler bugs due to it be a relatively small body of code. So in that context, I would like you to show that the handful you've highlighted is "a lot" against the backdrop of bugs in non-assembly code. My semi-informed (but not quantified) opinion is that you are broadly wrong and that there are not a lot of assembler bugs relative to C/C++ bugs.
- adamnemecek 6y agoRelative to what?
- saagarjha 6y agoRelative to zero.
- adamnemecek 6y agoNo its relative to the total amount of bugs.
- saagarjha 6y agoIn the context I was replying to, it's not. My response is to the claim that writing code in assembly has "few" bugs.
- adamnemecek 6y agoRight, comparatively.
- loeg 6y agoNo, it's pretty clear from the full context of the comment you are replying to that it is expressing a relative measure[1]: > Unsafe is not a problem in my experience. The same way a kernel might have some part written in asm (for freebsd it's like 1% I believe) your rust code will have 1% of Unsafe code. Might be more depending on what you are doing. However the same way few bugs happen in the asm code of a kernel, your unsafe will not have many bugs. [1]: https://news.ycombinator.com/item?id=23510862 https://news.ycombinator.com/item?id=23510862
- snkIaq 6y agoProven asm code like in TAOCP is safer than any other language. For example you know exactly what the FPU will do. Good luck with any compiler. I know that is not what people mean with "unsafe", but it is getting tiresome.
- ohgodplsno 6y agoTAOCP was written in different times, namely one where microcode was not a widespread thing. As it stands, your asm "proof" relies on having no µcode update. CPUs are no longer easy to understand like 8086s.