f python?

Shmuel Metz (Seymour J.) spamtrap at library.lspace.org.invalid
Tue Apr 10 06:52:47 EDT 2012


In <20120409111329.694 at kylheku.com>, on 04/09/2012
   at 06:55 PM, Kaz Kylheku <kaz at kylheku.com> said:

>Null-terminated C strings do the same thing.

C arrays are not LISP strings; there is no C analog to car and cdr.

>Code that needs to deal with null "characters" is manipulating
>binary data, not text,

That's a C limitation, not a characteristic of text. It is certainly
not true in languages unrelated to C, e.g., Ada, Algol 60, PL/I.

>If we scan for a null terminator which is not there, we have a
>buffer overrun.

You're only thinking of scanning an existing string; think of
constructing a string. The null only indicates the current length, not
the amount allocated.

>If a length field in front of string data is incorrect, we also have
>a buffer overrrun.

The languages that I'm aware of that use a string length field also
use a length field for the allocated storage. More precisely, they
require that attempts to store beyond the allocated length be
detected.

-- 
Shmuel (Seymour J.) Metz, SysProg and JOAT  <http://patriot.net/~shmuel>

Unsolicited bulk E-mail subject to legal action.  I reserve the
right to publicly post or ridicule any abusive E-mail.  Reply to
domain Patriot dot net user shmuel+news to contact me.  Do not
reply to spamtrap at library.lspace.org




More information about the Python-list mailing list