4 ms·
Can't we just enable bounds checking and gc and live with slowness. Shouldn't that be a choice, a compiler flag ? Every time there is a security issue, someone
by foobar_ 6y ago
Can't we just enable bounds checking and gc and live with slowness. Shouldn't that be a choice, a compiler flag ?
Every time there is a security issue, someone can see your naked pictures.
- _ph_ 6y agoNeither automatic bounds checking nor GC really add slowness. Any reasonably safe program will check the bounds explicitly, so there is no speed gained vs. guaranteed bounds checking via the compiler. Actually any good compiler can remove most bounds checks, if it can proove that the access is in bounds. Also GC can be quite faster than manual dynamic memory management.
- GordonS 6y agoDo you know of any fully-featured Web browsers that have been implemented with "safe" language, such as C# or Java? Would be a really interesting project to see!
- _ph_ 6y agoVery early on, Sun had a web browser implemented in Java. Unfortunately, this was dropped before Java got Hotspot and with that the decisive speed up. (They also had a web server implemented in Java, which sounds like an excellent idea too)
- zetafunction 6y agoThere's actually been quite a bit of work to bounds check accesses for containers implemented inside Chromium, such as span and optional, but it's harder to get these checks into upstream libc++. GC is one way to reduce the number of memory safety issues, but there are often tricky interactions between GC and non-GC code. Another issue with GC is it's often much harder to reason about object lifetimes.