Reply to post: Re: Good advice but

Carnegie-Mellon Uni emits 'don't be stupid' list for C++ developers


Re: Good advice but

> Some of the advice is borderline farcical, not because the advice is wrong but because the language allows those things to be written in the first place.

Any language flexible enough to give you full and total control over the machine is powerful enough to blow your foot off if used incorrectly.

The concept of C (and C++ presumably) is that the language is your servant. You tell it exactly what to do, and it does it (as long as it is a valid instruction). It doesn't advise you, it doesn't question you, and it doesn't deny you the ability to do something.

Of course, whether it does what you intended it to do, or goes off and kills a puppy, is an issue of programming ability and/or understanding the problem set you are trying to solve (and the constraints of the environment).

Like most tools, there is a time and place for it. I am not going to whip up a quick C program to parse a text file, but likewise I am not going to write a kernel (or embedded code) in Python or Bash.

I think it is a good thing that CERT has done this, like a "best practices" if you want to write more secure, less exploitable code. It is up to the end user whether to follow it, or whether they really need to access unallocated memory for some particular reason.

No comment on Rust, because I haven't had a look at it myself, but have heard good things from people.

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon

Biting the hand that feeds IT © 1998–2019