next up previous
Next:String Internals Up: Overview Previous: Notes on Division


Notes on Strcmp

Text comparision

Comparing two pieces of text using CMP may tell you if they are the same, but not if they are different. Two different text id's may indeed contain the same text. CMP on such a pair would result !, despite the two pieces of text being equal.

The only case where CMP behaves well is if both texts are either hard-coded or user inputted. Any modified text, using either APPEND or FETCH, loses the ability to be compared by CMP.

At the point that CMP is introduced, we have yet to use FETCH and only rarely use APPEND, so we can ignore these instructions and just claim that CMP will tell if two pieces of text are equal. Or, say that CMP resulting in ! means "i don't know", whereas CMP resulting in = definitely means "they're the same".

The actual strcmp algorithm will be a very good lesson for a later time in the class.
next up previous
Next:String Internals Up: Overview Previous: Notes on Division

by dlong@progmatism.com. Plz don't copy kthx.