U
user923005
Clem Clarke said:
C strings are perfectly safe. Some people, however, should not be let
anywhere near a text editor.
I think that this is a dangerous oversimplification, because the
language allows:
gets(str);
and
scanf() with %s
and memcpy which does not know how long the objects are
and strcpy which does not know how long the objects are
The billions of dollars of damage caused by computer virus attacks is
largely due to buffer overrun.
Let's not pretend that there isn't any problem. If we do not tread
carefully in C, we can do stupendous damage.
On the other hand, let's also not pretend that we can have s'afe and
fast'. We can have 'safe or fast'. Either I check the physical target
storage address of every character I transfer by stupendous effort or
I don't.
String handling in C is definitely the greatest weakness of the
language. And so we must be keenly aware of it and tread very, very,
very carefully.
IMO-YMMV
[snip]