Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!sun-barr!cs.utexas.edu!uunet!kddlab!titcca!sragwa!wsgw!socslgw!diamond From: diamond@csl.sony.co.jp (Norman Diamond) Newsgroups: comp.lang.c Subject: Re: strings Message-ID: <10250@socslgw.csl.sony.JUNET> Date: 15 May 89 02:48:25 GMT Sender: news@csl.sony.JUNET Reply-To: diamond@csl.sony.co.jp.csl.sony.co.jp (Norman Diamond) Organization: Sony Computer Science Laboratory, Inc. Lines: 37 I wrote: >>It [null-terminated strings] seems intrinsically worse to me. Doug Gwyn replied: >I thought it was well known that each method (associated count vs. >terminator) has advantages in some contexts and disadvantages in >others. Many interesting operations on strings are faster with null >terminator values than when an associated count must be tested. The >main drawback to terminated strings is that the terminator value >cannot be contained within the string. Fine. So in a language which does not specify how strings are implemented, an implementation could be improved by using BOTH a count and a null terminator. This still is not possible in C. >If you want counted strings, C makes it relatively easy to provide >them for yourself. Yes. You throw away the C library (which I understand is part of the proposed ANSI standard) and the language's definition of how strings are represented, you define your own representation of strings, and you implement your own library. This is perfectly fine. A strictly conforming program is not required to use every feature or every mis-feature of the standard; a program is allowed to be more strict. Good luck porting other people's strictly conforming programs though. They might use C strings. Good luck persuading someone else to port your programs. -- Norman Diamond, Sony Computer Science Lab (diamond%csl.sony.co.jp@relay.cs.net) The above opinions are my own. | Why are programmers criticized for If they're also your opinions, | re-implementing the wheel, when car you're infringing my copyright. | manufacturers are praised for it?