The unfortunate decision was Ritchie's original one to treat character strings as arrays of single characters.
All this was part of an episteme that viewed smallness/minimality and notional portability as highly desirable, crucial language characteristics. They are, of course, appealing; but they are also absurd. Statement-level procedural languages only cease to grow when they cease to be used, and C is now a behemoth too. This understood, it is still possible to have some sympathy for those who confronted the task of 'extending' C to provide support for varying-length strings. The PL/I halfword current-length prefix was not available to them, or at least they did not think that it was. They chose to use a string of 'conceptually unlimited' length and an end-of-string delimiter, nul or x'00', instead. The result, never perspicuous, proved to be a storage-management nightmare. Much worse, it opened up a Pandora's box of security troubles that will be with us for years to come; but it is not clear how else the original design deficiency could have been remedied. I retrospect it is clear that the remedy was worse than the deficiency it attempted to make good. It would have been better to do string processing in arrays, as was done in FORTRAN IV; but this was not obvious at the time, largely, I suspect, because it was not understood just how FORTRAN-like C is. John Gilmore, Ashland, MA 01721 - USA ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
