Re: C (functional programming) VS C++ (object oriented programming)
"Richard Heathfield" <rjh@see.sig.in valida écrit dans le message de news:
NNWdnU-UbpD7HZ_aRVnyig A@bt.com...
You are right, it is a matter of statistics. strncpy happens to be misused
a lot, causing various kinds of inefficiencies or downright bugs that lurk
in the dark corners of the code, waiting to bite at the least agreeable
moment.
Just don't use this stinking function, use strlcpy or equivalent instead,
when appropriate.
--
Chqrlie.
"Richard Heathfield" <rjh@see.sig.in valida écrit dans le message de news:
NNWdnU-UbpD7HZ_aRVnyig A@bt.com...
Ben Pfaff said:
>
<snip>
>
>
Right. I'm aware of the issues that are raised by misuse of strncpy - but
hey, any function can be misused. That doesn't necessarily make it a bad
function.
>
<snip>
>
>There is occasionally a good reason to use strncpy().
Right. I'm aware of the issues that are raised by misuse of strncpy - but
hey, any function can be misused. That doesn't necessarily make it a bad
function.
a lot, causing various kinds of inefficiencies or downright bugs that lurk
in the dark corners of the code, waiting to bite at the least agreeable
moment.
Just don't use this stinking function, use strlcpy or equivalent instead,
when appropriate.
--
Chqrlie.
Comment