* Aaron J. Grier <agr...@poofygoof.com> [2007-02-06 20:40]: > On Wed, Jan 31, 2007 at 01:54:16PM +0100, A. Pagaltzis wrote: > > Pascal strings however *are* in fact a great idea for a > > tiringly long list for reasons -- better than C strings in > > every conceivable way bar one or two. > > they're a great idea if they are handled transparently, as they > (almost) are in pascal. dealing with such constructs under C, > where the standard libraries are _not_ set up to deal with such > things, sucks. > > somestring[0] = strlen(&somestring[1]); > > bleck.
Well that's daffy anyway, for the simple reason that it's O(n). If you're doing it a lot, you might just as well use C strings. There should of course be a complete replacement string library if you're going to do Pascal strings so their handling is transparent in your own code; and ideally you'd only translate >from Pascal to C strings (constant time) rather than the other way (linear). Of course you can't avoid that entirely since there's so much code already out there that works on C strings. Sigh. Regards, -- Aristotle Pagaltzis // <http://plasmasturm.org/>