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... -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
