On Tue, 22 Nov 2005, Jamie Wilkinson <[EMAIL PROTECTED]> wrote...

 > This one time, at band camp, Benno wrote:
 > >So yeah, I was reading about pascal strings the other day. Pretty cool.
 > >Apparently Mac9 used them in its libraries. (Could easily be wrong there.)
 > >
 > >The idea is that the first byte of memory holds the length of the string.
 > >(Which limits you to a 256 length string.)
 > >
 > >But means operations strlen is O(1), not O(n). And something like strdup can
 > >avoid a double iteration through the list, and strcat can avoid trawling the
 > >first list. Etc, etc.
 > >
 > >If course declaring a string inline becomes a bit tricker:
 > >
 > >char *s = "\005pants";
 > >
 > >And also standard C compiler will waste a byte NULL-terminating it even
 > >though you don't need to.
 > >
 > >So there is your trivia for the day.
 > 
 > Also limits you to 255 char length strings, at least back in the day Borland
 > Pascal did...
 
 http://www.joelonsoftware.com/articles/fog0000000319.html

 and a nice little(?) article on pascal strings, ASCIZ and a bit about 
 pointers.

-- 
[---------------------------------------------------------------------------]
 Alex Sayle                                          [EMAIL PROTECTED]

-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to