Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Sep 1999 05:54:49 -0400
From:      W Gerald Hicks <wghicks@bellsouth.net>
To:        "Dennis" <dennis@etinc.com>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: A bug in the sppp driver? 
Message-ID:  <199909300954.FAA02650@bellsouth.net>
In-Reply-To: Your message of "Wed, 29 Sep 1999 17:25:15 BST." <038d01bf0a97$3652f8d0$2e00a8c0@nt46daniel> 

next in thread | previous in thread | raw e-mail | index | archive | help

> doing state machines with switch statements is a big mess.

Still, you'll find a lot of them around.  Do you have a favored
technique for coding complex state machines?  (I'm a collector :)

One scheme I've been using for quite some time is to use a function
pointer as a 'state variable', sometimes making a stack of them for
a more flexible machine.

Sometimes I use a transition matrix for selection of the 'state function'
but more often the functions themselves perform 'next state' selection.

To be honest though, most of the time the machinery I need for an
application has from four to six states.  Anything more than a simple
switch on a state variable seems to be overkill for those.

Cheers,

Jerry Hicks
wghicks@bellsouth.net


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199909300954.FAA02650>