Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages   Examples  

loopstate-counting.cpp

Here's a simple program which counts down from 10 to 1, but getting the numbers through an opaque interface (testfetch()).

#include <iostream.h>
#include <blindfold/LoopState.h>

#define MAX 10

int testfetch(LoopState& ls) {
    if (ls.data.as_int == 0) {
    ls.data.as_int = MAX+1;
    }
    ls.data.as_int--;
    return ls.data.as_int;
}

int main()
{
    LoopState ls;
    while (int i=testfetch(ls)) {
    cout << i << endl;
    }

    return 0;
}

Home to blindfold. This page generated via doxygen 1.2.11.1 Wed Oct 10 16:40:33 2001.