delorie.com/archives/browse.cgi | search |
X-Authentication-Warning: | delorie.com: mail set sender to djgpp-bounces using -f |
From: | "MikeC" <My_address AT end DOT of DOT post> |
Newsgroups: | comp.os.msdos.djgpp |
References: | <TfIBi.37363$rr5 DOT 32521 AT newsfe1-win DOT ntli DOT net> <200708302337 DOT l7UNb83E010710 AT envy DOT delorie DOT com> |
Subject: | Re: struct vs. typedef struct |
Lines: | 42 |
X-Priority: | 3 |
X-MSMail-Priority: | Normal |
X-Newsreader: | Microsoft Outlook Express 6.00.2900.3138 |
X-RFC2646: | Format=Flowed; Original |
X-MimeOLE: | Produced By Microsoft MimeOLE V6.00.2900.3138 |
Message-ID: | <LY_Bi.925$gA6.891@newsfe2-gui.ntli.net> |
Date: | Fri, 31 Aug 2007 20:35:55 GMT |
NNTP-Posting-Host: | 86.13.154.18 |
X-Complaints-To: | http://netreport.virginmedia.com |
X-Trace: | newsfe2-gui.ntli.net 1188592555 86.13.154.18 (Fri, 31 Aug 2007 21:35:55 BST) |
NNTP-Posting-Date: | Fri, 31 Aug 2007 21:35:55 BST |
Organization: | ntl Cablemodem News Service |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
Scott and DJ, Once again, thanks for your help. Sorry I didn't find it in the FAQ - I did look, but I guess, not enough. All of the Best, Mike. BTW, isn't this a moderated group? Couldn't all that "MI5 Persecution" stuff just be deleted? I didn't read all of it, but it didn't seem to have much relevance to DJGPP or to C. "DJ Delorie" <dj AT delorie DOT com> wrote in message news:200708302337 DOT l7UNb83E010710 AT envy DOT delorie DOT com... > >> I'm not sure whether this is a DJGPP question or a C question, > > It's a C question. > >> but I think the problem is due to the single-pass compilation of >> DJGPP. > > Nope. > >> ... the compiler doesn't like it, I guess because when it encounters >> *next, >> it hasn't seen the reference to S yet. > > typedet struct S1 > { > struct S1 *next; > } S2; > > You can't use a typedef (S2) until after it's defined. You can use a > struct (S1) without a full reference; a typedef like the above can > include a struct definition (S1) and a "forward" struct usage (struct > S1 ...). > > Normally, you'd use the same name for S1 and S2 in the example above.
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |