strings

Peter da Silva peter at ficc.uu.net
Mon May 15 05:05:07 AEST 1989


C strings have a major disadvantage that's got nothing to do with performance.
You can't just stick arbitrary binary data in a string and expect it to work.
If there is a null anywhere in that data it's going to cut you.

Strings in variant-record form, with a length and data, or dope vectors, with
a length an a pointer, are just plain more versatile than C strings.

Luckily, however, 'C' is not tied to its runtime library. It's possible to
not only use a completely different kind of string in the language, but to
mix the two. It's a pity X3J11 didn't see fit to standardise a 'length' escape
like the common "\p" (for 'pascal') on the Mac. Maybe "\l".
-- 
Peter da Silva, Xenix Support, Ferranti International Controls Corporation.

Business: uunet.uu.net!ficc!peter, peter at ficc.uu.net, +1 713 274 5180.
Personal: ...!texbell!sugar!peter, peter at sugar.hackercorp.com.



More information about the Comp.lang.c mailing list