[Info-vax] Whither VMS?
Michael Kraemer
M.Kraemer at gsi.de
Fri Oct 2 01:45:57 EDT 2009
glen herrmannsfeldt schrieb:
>
> I have. I have seen strcat() called inside a loop for building
> up a string while reading it in one line at a time. The resulting
> algorithm is O(n**2). (O(pow(n,2)) for C programmers.) It was
> fast enough in testing, but in production the strings were millions
> of characters long and most of the time was spent in that loop.
The str*() functions exist for convenience.
If one has problems of that kind, I'd indeed store
data in a dedicated struct (ptr,len).
>
> One result of null termination is the easy buffer overflow of
> many programs today
Such as?
> that don't properly check lengths.
this is not restricted to null-termination.
Anyway, I do not see why null termination would
naturally lead to buffer overflow.
I'm not aware of any libc function which
uses the null to mark the end of an area you
are allowed to *write* to.
With the exception of *printf() (and gets()) all writable
buffers have a specified maximum length.
More information about the Info-vax
mailing list