home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!mcsun!Germany.EU.net!ira.uka.de!news.belwue.de!eratu.rz.uni-konstanz.de!DG1.CHEMIE.UNI-KONSTANZ.DE!mueller
- From: mueller@DG1.CHEMIE.UNI-KONSTANZ.DE (Christian M"uller)
- Subject: struct / union / function declaration
- Message-ID: <1993Jan12.115527.136146@eratu.rz.uni-konstanz.de>
- Lines: 29
- Sender: usenet@eratu.rz.uni-konstanz.de
- Reply-To: mueller@DG1.CHEMIE.UNI-KONSTANZ.DE (Christian M"uller)
- Organization: Fakultaet fuer Chemie, Universitaet Konstanz
- Date: Tue, 12 Jan 1993 11:55:27 GMT
- Lines: 29
-
-
- I have a problem defining a union like this:
-
- struct s {
- union node *arg;
- union node (*func)(union node);
- };
-
- union node {
- struct s fun;
- int n;
- };
-
- Use gcc -Wall for compiling. Exists there *ANY* solution for defining
- this without getting compiler warnings?
-
- Note that struct s must be defined before the union definition.
- Note also that we need a prototype definition for func here, otherwise
- ge get an error somethere later.
-
- A similar problem is the following:
-
- struct x {
- int (*func)(struct x);
- };
-
- Any hints would be appreciated
-
- Christian W. M"uller
-