Sentinel while loop for C++
A "sentinel" in this context is a special value used to indicate the end of a sequence. The most common sentinel is \0 at the end of strings. A "sentinel while loop" would typically have the form:
while (Get(input) != Sentinel) {
Process(input);
}
A sentinel is a special value, e.g. boolean value, extremely big or small. It is used to determine when to stop the loop.
A good example is in the implementation of merge sort, e.g. read page 4 of http://www.cs.princeton.edu/courses/archive/spr07/cos226/lectures/04MergeQuick.pdf.