Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!sharkey!atanasoff!hascall From: hascall@atanasoff.cs.iastate.edu (John Hascall) Newsgroups: comp.arch Subject: Re: String lengths Message-ID: <765@atanasoff.cs.iastate.edu> Date: 6 Feb 89 17:46:00 GMT References: <8876@alice.UUCP> Reply-To: hascall@atanasoff.cs.iastate.edu (John Hascall) Organization: Iowa State U. Computer Science Department, Ames, IA Lines: 33 In article <8876@alice.UUCP> dmr@alice.UUCP writes: >The question arose: why does C use a terminating character for >strings instead of a count? [...discussion of the history of "strings" in C omitted...] >In my opinion, C's array/pointer scheme for representation >of character strings has worked out reasonably well, although >it is somewhat clumsy when there are lots of string operations. >I don't think it has been demonstrated that the usual run of >C programs pays an extremely high cost in performance for their >string operations, though doubtless there are counterexamples >for particular machine architectures or particular programs. This is a rather circular argument. This is rather like saying "I don't think it has been demonstrated that the usual automobile pays an extremely high cost in performance for their amphibious operations,..." Just like most people don't drive their cars across lakes, most C programs are not string operation intensive. If I had to cross a lake, I'd probably use a different tool than a car. If I had to write a string operation intensive program, I'd probably use a different tool than C. John Hascall ISU Comp Center Rx: Apply :-) above as needed for pain.