Afficher un message
Vieux 18/10/2007, 06h23   #6
Richard Heathfield
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Bug/Gross InEfficiency in HeathField's fgetline program

pete said:

> Richard Heathfield wrote:
>
>> Richard's attitude towards strncpy is this:
>>
>> (a) it has a lousy name;
>> (b) there is rarely any point in using it;
>> (c) it is likely that most uses of it are flawed;
>> (d) there are occasions on which it is The Right Thing;
>> (e) because of (c), it is tempting to advise people to eschew it
>> completely, but because of (d),
>> he thinks that a better solution would be
>> to educate people about its proper use
>> and to correct their misconception that it is a "safe" strcpy.

>
> I have never written a program that used strncpy,
> except as an academic exercise.
>
> How often do you use strncpy, Dr Heath Field?


Well, I've just checked my current code base here, and can't find any
instances at all. That doesn't mean I won't find instances in older code,
and it doesn't mean I've never used it "on site", so to speak, but it does
seem that I rarely if ever use it. It is entirely possible that, like you,
I have never called it in production code. I don't recall ever doing so,
anyway. But I do know how it works, and I know how to use it if ever the
need should arise. :-)

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
  Réponse avec citation
 
Page generated in 0,05890 seconds with 9 queries