5 ms·
Well, I can say the same about Python, Erlang, Lua, in addition to C and C++. I believe C is not worse than these languages, only that C requires different (som
by yaris 8y ago
Well, I can say the same about Python, Erlang, Lua, in addition to C and C++. I believe C is not worse than these languages, only that C requires different (sometimes very different) skills and discipline.
- pjmlp 8y agoPython, Erlang, Lua = Logic Errors C and C++ = Logic Errors + Memory Corruption + UB From this point of view, Σ Logic Errors < Σ (Logic Errors + Memory Corruption + UB)
- jcelerier 8y agohmmm... In my experience, I have had much less logic errors in C++ than in Python or JS because I tend to try to encode the domain logic into the types as much as possible, so that I can piggyback on the compiler.
- pjmlp 8y agoAnd how many memory corruption and UB errors did your Python and JS code had?
- jcelerier 8y agonone, but I hardly ever encounter them in C++ too since I always develop in debug mode with sanitizers and debug std containers, so they blow up immediately. In C that's another story...
- pjmlp 8y agoSo you are part of the 1% audience crowd from CppCon, developing software alone in C++ without any third party binary libs. :)
- vardump 8y agoI'm absolutely sure same skill level programmer will create less defects in Python, Erlang and Lua than in C. You really have to try to overwrite memory in those languages. Of course you can shoot yourself into foot with stuff like metatables in Lua and Python metaclasses and whatnot. Then again you should see some C macro messes around... Anyways I don't like when people defend C with that age old argument it requires a clever disciplined programmer that never makes mistakes. Because either such programmers don't exist or they're very rare.
- notacoward 8y ago> I'm absolutely sure same skill level programmer will create less defects in Python, Erlang and Lua than in C. Fewer defects, or just different (arguably less severe) defects? It's great that you're sure, but evidence would be even better.
- vardump 8y agoOk, that's a fair point. I don't have the evidence for that. Scripting languages do have their pitfalls. Lua and python can have type mismatches and even typos causing misbehavior, things that usually aren't issues with C. However, you do need significantly less code than in C.