The other one I use it for is jumping past the top of a loop the first
time only (this code probably doesn't work but you get the idea...):
#define DIM(a) (sizeof (a) / sizeof (*(a)))
int ary[4] = {1,3,5,7};
.
.
.
print_ary (ary, DIM (ary));
void print_ary (int *aryp, int n)
{
goto skip_comma;
for (;n;aryp++, n--)
{
printf (", ");
skip_comma:
printf ("%u", *aryp);
}
printf ("\n");
}
State machines? If it is complex enough usually the better solution is
a two-way (current state, input) table of function pointers, unless
your implementation language doesn't support some analog to function
pointers...
-- John.