Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!decwrl!sun!pitstop!sundc!seismo!uunet!mcvax!kth!enea!maxim!prc From: prc@maxim.ERBE.SE (Robert Claeson) Newsgroups: comp.arch Subject: Re: String lengths Message-ID: <499@maxim.ERBE.SE> Date: 7 Feb 89 08:30:07 GMT References: <6133@columbia.edu> <5124@aldebaran.UUCP> <7@microsoft.UUCP> <762@atanasoff.cs.iastate.edu> Organization: ERBE DATA AB Lines: 32 In article <762@atanasoff.cs.iastate.edu>, hascall@atanasoff.cs.iastate.edu (John Hascall) writes: > > - All machines I know of that have character string instructions want > > the length of the string. This forces the string primitives to first > > scan for null, a time wasting operation. > I assume you mean something like: > +------+---+---+---+---+---+---+---+---+---+---+---+---+---+ > |length| H | E | L | L | O | , | | W | O | R | L | D | \n| > +------+---+---+---+---+---+---+---+---+---+---+---+---+---+ > but, what size would you use for "length", a byte? a word? a longword? A 16-bit word, just to remain compatible with all the 16-bit machines out there. > I suspect that some of these machines' instructions expect different > sized operands for the length. Some expects 16 bits, some expects 32 bits, and a few (such as the old Z-80) expects 8 bits. > Also, to quote K&R: "C was originally designed ... on the DEC PDP-11", > a machine with no string instructions. Well, what can we learn from this? -- Robert Claeson, ERBE DATA AB, P.O. Box 77, S-175 22 Jarfalla, Sweden "No problems." -- Alf Tel: +46 758-202 50 EUnet: rclaeson@ERBE.SE uucp: uunet!erbe.se!rclaeson Fax: +46 758-197 20 Internet: rclaeson@ERBE.SE BITNET: rclaeson@ERBE.SE