home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / c / 12357 < prev    next >
Encoding:
Text File  |  1992-08-14  |  1.3 KB  |  49 lines

  1. Path: sparky!uunet!wupost!usc!sdd.hp.com!uakari.primate.wisc.edu!ames!olivea!sgigate!sgiblab!ultra!jimh
  2. From: jimh@ultra.com (Jim Hurley)
  3. Newsgroups: comp.lang.c
  4. Subject: Help with function typedef.
  5. Message-ID: <1992Aug14.223459.2638@ultra.com>
  6. Date: 14 Aug 92 22:34:59 GMT
  7. Organization: Ultra Network Technologies
  8. Lines: 39
  9.  
  10. I don't understand what's happening here, can anyone help?
  11.  
  12. File x.c (between the dahed lines):
  13. --------------------------------------------
  14. typedef unsigned char CLI_RETURN_CODE;
  15.  
  16. typedef CLI_RETURN_CODE (*CLI) (int, char **);
  17.  
  18. typedef struct {
  19.     char * command_name;
  20.     char * command_description;
  21.     CLI command_entry;
  22. } CLI_Command_Table;
  23.  
  24. /* prototype */
  25. CLI cli_help;
  26.  
  27.  
  28. CLI_Command_Table cli_command_table[] = {
  29.    "help",   "List available commands",  cli_help
  30. };
  31.  
  32.  
  33. CLI_RETURN_CODE cli_help (int argc, char **argv) {
  34.  
  35.   /* nothing yet */
  36.   
  37. }
  38. --------------------------------------------
  39. Compilation results:
  40.  
  41. gcc -c x.c
  42. x.c:17: initializer for static variable is not constant
  43. x.c: In function cli_help:
  44. x.c:20: `cli_help' redeclared as different kind of symbol
  45. x.c:12: previous declaration of `cli_help'
  46. -- 
  47. Jim Hurley --> jimh@ultra.com  ...!ames!ultra!jimh  (408) 922-0100
  48. Ultra Network Technologies / 101 Daggett Drive / San Jose CA 95134
  49.