home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / c / 16109 < prev    next >
Encoding:
Internet Message Format  |  1992-11-08  |  1.2 KB

  1. Path: sparky!uunet!charon.amdahl.com!pacbell.com!tandem!UB.com!grafex!athertn!infopiz!decwrl!pa.dec.com!oct17.dfe.dec.com!ryn.mro4.dec.com!subsys.enet.dec.com!uyeno
  2. From: uyeno@subsys.enet.dec.com (Alice Uyeno)
  3. Newsgroups: comp.lang.c
  4. Subject: need to create a jump table 
  5. Message-ID: <1992Nov3.025210.27336@ryn.mro4.dec.com>
  6. Date: Tue, 3 Nov 1992 02:52:10 GMT
  7. Sender: news@ryn.mro4.dec.com (USENET News System)
  8. Reply-To: uyeno@subsys.enet.dec.com (Alice Uyeno)
  9. Organization: Digital Equipment Corporation
  10. Lines: 14
  11.  
  12.  
  13. Hi,
  14.  
  15. I'm trying to develop a jump table.  Actually, the scenario is that I have two jump tables.  Depending on the value of a certain flag, I use one or the other.  Each jump table consists of pointers to functions.  I'm wondering if it is possible to have the functions with varying number of parameters.  For example, if my jump table contains pointers to ErrorRoutine and ValidateCmd, where the prototypes for the routines are as follows:
  16.  
  17.     void ErrorRoutine(int *ErrCode, struct foo * MyPtr);
  18.         void ValidateCmd(struct foo * CmdPtr);
  19.  
  20. void (* FcnTbl[])() = {ErrorRoutine,ValidateCmd};
  21.  
  22. where 
  23.     ptr = FcnTbl;
  24.  
  25. and ptr is how the jump table is referenced.
  26.