home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!spool.mu.edu!hri.com!enterpoop.mit.edu!eru.mt.luth.se!lunic!sunic!aun.uninett.no!nuug!ifi.uio.no!nntp.ifi.uio.no!jar
- From: jar@solva.ifi.uio.no (Jo Are Rosland)
- Newsgroups: comp.lang.c
- Subject: Re: struct vs. typedef
- Message-ID: <JAR.93Jan10152829@solva.ifi.uio.no>
- Date: 10 Jan 93 14:28:29 GMT
- References: <uRL4wB7w165w@cybrspc.uucp>
- Sender: jar@ifi.uio.no (Jo Are Rosland)
- Organization: Dept. of Informatics, University of Oslo, Norway
- Lines: 31
- Nntp-Posting-Host: solva.ifi.uio.no
- In-Reply-To: roy%cybrspc@cs.umn.edu's message of Sat, 09 Jan 93 01:10:17 CST
- X-Md4-Signature: 31943765224661c43f5ea776587e1329
- Originator: jar@solva.ifi.uio.no
-
- In article <uRL4wB7w165w@cybrspc.uucp> Roy M. Silvernail writes:
-
- typedef struct n {
- int x,y;
- struct n *last,*next, *up, *down;
- void (*show)(struct n *);
- int width;
- void **value;
- } ITEM;
-
- Now, this works, but it sure seems clumsy. Is this really the only way
- to do this type of construct? If not, is it the optimal solution, or is
- there some extremely clever trick I'm missing?
-
- Given C, that's the best you can get. You'll just have to get used to
- it, just like the rest of us :-).
-
- C++ on the other hand, is another matter. There the following code
- segment is legal:
-
- struct node {
- node *prev;
- node *next;
- // whatever else you need
- };
-
- node n1;
- node *p1;
- --
- Jo Are Rosland
- jar@ifi.uio.no
-