On 24/02/2019 16:21, R.Wieser wrote:
> (too many newsgroups, had to snip a few)
>
> Richard,
>
>> Indeed, although I'd cache the length rather than make the compiler find
>
> :-) And thats exactly the kind of thing you should try to avoid.
>
> In this simple example it will work, but you're /still/ trying to write a
> full buffers worth - when you should leave that last character untouched,
> just in case.
>
> Ofcourse, I would rather check the length of the to-be-copied string and
> throw an error when it doesn't fit, but maybe thats just me ... (Just
> imagine you're copying some kind of commandline string, with a few argument
> switches at the end).
>
That is an option if you know roughly what SHOULD be there.
> Regards,
> Rudy Wieser
>
>
>
>
--
"The most difficult subjects can be explained to the most slow witted
man if he has not formed any idea of them already; but the simplest
thing cannot be made clear to the most intelligent man if he is firmly
persuaded that he knows already, without a shadow of doubt, what is laid
before him."
- Leo Tolstoy
--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)
|