Path: utzoo!mnetor!uunet!husc6!hao!ames!umd5!uvaarpa!mcnc!rti!xyzzy!throopw From: throopw@xyzzy.UUCP (Wayne A. Throop) Newsgroups: comp.arch Subject: Re: Null-terminated C strings Message-ID: <504@xyzzy.UUCP> Date: 23 Dec 87 19:52:14 GMT References: <261@ivory.SanDiego.NCR.COM> <164@sdeggo.UUCP> <174@quick.COM> <7085@apple.UUCP> Organization: Data General, RTP NC. Lines: 23 > baum@apple.UUCP (Allen J. Baum) >> srg@quick.COM (Spencer Garrett) >>The general paradigm is: >> while (the next character is within the interesting range) >> do something interesting with it; >> now look at what the uninteresting character was; > While this is nice in theory, in practice there can be some very subtle > problems with lookahead, especially if the string ends on a page boundary, > and the lookahead of the next character causes an access violation. The string is ill-formed if the terminating character isn't there. Such problems can happen in other string formats, such as a record where the length reaches off the end of the valid address space. Thus, this objection is not specific to terminated strings, but to any variable length string construct whatsoever. The problem being "what happens if the length isn't specified correctly and you wander off the end of the string". -- There are some forms of insanity which, driven to an ultimate expression, can become new models of sanity. --- Bureau of Sabotage {Frank Herbert} -- Wayne Throop !mcnc!rti!xyzzy!throopw