home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / c / 19576 < prev    next >
Encoding:
Text File  |  1993-01-12  |  1.1 KB  |  42 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!mcsun!Germany.EU.net!ira.uka.de!news.belwue.de!eratu.rz.uni-konstanz.de!DG1.CHEMIE.UNI-KONSTANZ.DE!mueller
  3. From: mueller@DG1.CHEMIE.UNI-KONSTANZ.DE (Christian M"uller)
  4. Subject: struct / union / function declaration
  5. Message-ID: <1993Jan12.115527.136146@eratu.rz.uni-konstanz.de>
  6. Lines: 29
  7. Sender: usenet@eratu.rz.uni-konstanz.de
  8. Reply-To: mueller@DG1.CHEMIE.UNI-KONSTANZ.DE (Christian M"uller)
  9. Organization: Fakultaet fuer Chemie, Universitaet Konstanz
  10. Date: Tue, 12 Jan 1993 11:55:27 GMT
  11. Lines: 29
  12.  
  13.  
  14. I have a problem defining a union like this:
  15.   
  16. struct s {
  17.         union node *arg;
  18.         union node (*func)(union node);
  19. };
  20.  
  21. union node {
  22.         struct s fun;
  23.         int n;
  24. };
  25.  
  26. Use gcc -Wall for compiling. Exists there *ANY* solution for defining
  27. this without getting compiler warnings?
  28.  
  29. Note that struct s must be defined before the union definition.
  30. Note also that we need a prototype definition for func here, otherwise
  31. ge get an error somethere later.
  32.  
  33. A similar problem is the following:
  34.  
  35. struct x {
  36.     int (*func)(struct x);
  37. };
  38.  
  39. Any hints would be appreciated
  40.  
  41. Christian W. M"uller
  42.