I have to disagree.  C programming is primarily the manipulation of pointers
not switch statements.  Yes, all compilers have to handle pointers, but "C"
allows the programmer to decide at what level they wish to develop.

If events were treated as indexes into a jump table, would it not greatly
reduce the processing of switch or if statements?

"Richard Burmeister" <[EMAIL PROTECTED]> wrote in message
news:52260@palm-dev-forum...
>
> > From: Kapil Konde
> >
> > But again in form event handler thare comes switch statements for
various
> > form events I want to avoid them....
> >
>
> Hey, that's what C programming is all about!  The OS sends various events
to
> your handler, and your handler has to respond to some of them and pass the
> others on.  You can use a switch statement or a bunch of if statements.
>
> Delphi has a great method of dealing with this for Windows programs - you
> just define event handlers for each of the events you want to handle and
the
> compiler invisibly creates a big switch statement for you that actually
> calls the event handlers.  Even then, there really is just a big switch
> statement somewhere.
>
> Basically, any event driven architecture requires a big switch statement
to
> handle all the events that come in.
>
> The only alternative I can think of is to use function pointers and create
> some way to directly call the appropriate function based on the event.
> However, deciding which function to call is probably going to require a
big
> switch statement.  Maybe you could directly generate the appropriate
> function pointer from the event number, using a sparse array...
>
>
>



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to