4 ms·
I think in software engineering it's prudent to just assume that all developers make mistakes sometimes. Anything that can have developers make less mistakes or
by tdb7893 10y ago
I think in software engineering it's prudent to just assume that all developers make mistakes sometimes. Anything that can have developers make less mistakes or can catch developer mistakes saves time (and therefore money) in the long term so I think it's fair to complain that c makes mistakes easy and difficult to catch.
- Baeocystin 10y agoComplaining about C in this manner strikes me as complaining that the knife you're using is too sharp, and you don't have time to make sure you won't cut yourself. Don't get me wrong. I prefer working in Python or its ilk, because I prefer a higher level of safeguards. But nothing I work on needs the precision of behavior that C provides. And sometimes you need sharp and precise.
- dbaupp 10y agoC is not precise, not as a model of modern CPUs (they're very different to the PDP-11, and compiler optimisers are very invasive) nor as a precision engineering tool (too many silent footguns and landmines adding a pile of incidental complexity). It's definitely true that it's sharp and sometimes (currently) the best tool for the job, but don't ignore the reality of its design and limitations when praising it.
- ori_b 10y agoI'm not sure where this meme that C is a direct translation to PDP-11 assembly came from. It's true that there were some quirks in K&R C that came from it (eg, the way that floats were widened to doubles when being passed to functions), but those largely went away with ANSI C. Other than that, C isn't a significantly better match for PDP-11 than it is for x86 or alpha or sparc.
- kbenson 10y agoC is like swinging a very sharp Katana to make small precise incisions. You need to stand far back to have any home of success, and you need to be very precise. With practice, your cuts may be be very precise, but it takes a lot of skill and effort. Until that point (some occasionally thereafter), a lot of accidents happen...
- csours 10y agoWith a knife, you know where the sharp bit is. With C, sometimes the handle explodes, killing everyone in the kitchen.
- blackflame7000 10y agoYea if you hold it wrong. Undefined behavior doesn't magically happen.
- csours 10y agoSure, but who makes knife handles out nitroglycerin? You are absolutely correct that the areas of Undefined behavior are well defined in C, and should be taken into account. In programming, as in all products, the winning combination is good enough + quick enough. When using C, code has to be much higher quality than other languages. Anyway, my point of view is that you should be REALLY REALLY sure you NEED C before using it. It is a very sharp knife, and it only takes one false move.
- Baeocystin 10y agoI don't really disagree with anything you're saying. But that being said, for the times you do need C, what are the better alternatives? C# is managed, solves a ton of problems...and is completely unusable for driver development. C++ just gives you more rope to hang yourself. It seems to me that its danger and utility are inseparable elements of the same ultimate thing.
- csours 10y agoI agree completely. Many projects (and individuals) do not have the discipline to use C properly. If you need to use C, you need to take the time and care to use it properly.
- deleted 10y ago[deleted]
- 10y ago