Hacker News new | ask | show | jobs
by chuckadams 42 days ago
> C is not to blame for programmers using its features unwisely

"Make no mistakes" works about as well for humans as it does for AI, and we have decades of lived experiences to draw on for that verdict.

2 comments

And this isn't even a new thing for Programming. We already learned this lesson once.

Go look at a nineteenth century mechanical signal box. When you, through inattention or even malevolence, try to release signals so that train B can plough into train A, the lever won't move because it is physically impossible due to mechanical interlocking, you need to move a piece of sold metal through another piece of solid metal and it won't go.

Do not rely on humans to do boring but important things, they are very bad at this.

I didn't say "make no mistakes". I said "using its features unwisely". If you can't write software that manages shared mutable state, then don't do it. The world still needs lots of simpler programs.
In this case the features are things like "allocating memory on the heap" and "incrementing a pointer."

It isn't like C has some "there be dragons" set of features that are hard to use. The source of exploitable memory safety issues is consistently just foundational language features.

Why can't simpler programs be written in languages that at least make an attempt to be memory-safe?
Of course you can. You should pick the right tool for the job.

There is a catch, however. Some languages will not allow you to take some shortcuts you know are safe unless you can prove them safe.