Right. C with Lua is a nice combination serving a wider range of projects without sacrificing C's approach to low-level correctness.
I love Lua, but what stack would allow you to use it in a web project?
Re:How can C Programs be so Reliable?
by stonemetal on Thursday September 22, 2011 @01:35PM
(#3026883)
Mongrel2 has a Lua web framework called tir.
Re:How can C Programs be so Reliable?
by demallien on Thursday September 22, 2011 @10:57AM
(#3026270)
Precisely. These days, with the advent of easy to integrate Javascript/Python/Ruby/Lua scripting languages, there is very little reason to write an entire application in C. My last two projects, I wrote the business logic in a scripting language, and all of the performance bound stuff in C. There are a few gotchas the first time you do this - your bindings code needs to fit with the object model that you're using in C, you need to force all calls into the VM onto the same thread etc. I ended up just writing my own IDL parser/bindigs generator, but once you've done that once, you can use it for all of your future projects, and it really isn't that much work. The pay-off is huge - you can arbitrarily move a module of code between C and your scripting language depending on the optimal split for performance/ease of programming.
Very true. When you have managers shouting "get it out" and over-promising to clients, then any language is a bad choice, but particularly powerful languages that require more careful thought and testing. I love C++ and use it regularly, but when I need to "get stuff out quickly" I'll use something like Python as I can be more reckless with it.
Not just incompetence. Also bad language choice (usually due to legacy).
If programmers don't get enough time to properly test and review the code, which needs to be done very thoroughly in C, it's easy for even experienced developers to shoot themselves in the foot.
C is very good (let's say irreplacable) for low-level hardware and OS code. This is code that needs to be verified and tested very well.
On the other hand, using C for run-of-the-mill business projects or higher-level stuff on a tight deadline can be a very bad idea. It results in a lot of overhead for programmers to think about the details of error handling, buffer sizes, pointers, memory allocation/deallocation and so on, especially getting it right for every function. It is a recipe for screwups.
In this case it is very useful to have garbage collection, bounds checking, built-in varlength string handling, and other "luxuries" that modern languages afford you.