4 ms·
How do you define problem? In terms of consequences or mere presence of a bug? If it's consequences, is it plausible that you have had no problems because not
by sbov 10y ago
How do you define problem? In terms of consequences or mere presence of a bug? If it's consequences, is it plausible that you have had no problems because not enough people are interested in attacking your code? If you say you have never produced a memory/pointer related bug that got past you, then you probably are the rain man.
- jstewartmobile 10y agoI mean that through strict valgrind and fuzzers, I've never had it find anything in my own code. I've also never had a hard-crash from anything in my own code. I attribute this to personal paranoia about input and indices. Worst experiences I've had in that domain were due to inconsistencies in things like the Win32 API across different OS versions that were allegedly supposed to behave the same way. Sometimes I think better API and language documentation would improve programs more than better languages.
- geofft 10y agoWouldn't you prefer to have the computer deal with the personal paranoia for you? I love C dearly, but I can write so much faster in, say, Python, and that code is usually production-suitable. If I say "for line in open(sys.argv[1])", I don't have to spend 50 lines dealing with open() failing, or sys.argv() being the wrong length, or allocating a buffer to read into and recombining lines longer than the buffer, or whatever. Ideally in Python I'd print better error messages, but it's fine if I forget; Python will take care of each of those problems and do something safe, if not user-friendly. If I forget any of those in C, it's emphatically not fine. Rust - and many other higher-level compiled languages! - promise to bring that development speed and confidence back to the domains where C dominates.
- jstewartmobile 10y agoI do prefer it, and for new things, I love Rust and Golang and Clojure. I even kind-of like Python (aside from the blocks-by-indentation thing). I'm just saying that for old things, staying the course will probably be more fruitful than fresh start in a different language.
- kbenson 10y agoThat's why the spurred interest in C and C++ in providing more safety mechanisms, which I believe is because of the increased competition in this realm from Rust, is a good thing. If we can get most the way to what Rust provides in C and C++ through tooling and extensions, there's a path for existing source that can't or shouldn't be rewritten, and new projects get to make a choice of what they want to use.
- Manishearth 10y agoI believe that most of the C++ safety stuff happened independently of Rust existing. A lot of it started before Rust was a big thing.
- kbenson 10y agoSure, but I would argue that there's much more interest in it now that there's a credible alternative that does care about it. That is, it existed, and people used it, but now people might feel a little bit of a need to justify why they are using C or C++ when then didn't before, and so their confirmation bias might cause them to look more into those existing safety mechanisms, and maybe even use them. Put another way, even if Rust were to disappear tomorrow, I think the net impact would have been very positive in that it exposed people to these concepts in a concrete way they weren't before, because they are optional in the C and C++ ecosystem.