Re: trim whitespace



On Wed, 25 Aug 2010 00:15:50 -0700, "James" <no@xxxxxxxxxxxx> wrote:

But you have no safeguard against memory having no \0 byte.

Well, neither do you John. If I pass your function memory that does not have
a terminating NUL byte, then it will gladly read right past the bounds and
off into never never land...

You are thinking of C strings. There are no "bounds" to a pointer.
You can increment a pointer until it wraps back to 0, and repeat that
loop forever.

If you try to read that memory, you may segfault and terminate. But
that is beside the point. My code copes with an abstract machine where
one process owns all the memory, from 0 to the highest address.

That may not be a real world scenario, but again, that is beside the
point. My code copes with abstract near impossibilities. That's the
way a programmer should think.



--
Web mail, POP3, and SMTP
http://www.beewyz.com/freeaccounts.php

.