delorie.com/archives/browse.cgi | search |
X-Authentication-Warning: | delorie.com: mail set sender to djgpp-bounces using -f |
Date: | Thu, 30 Aug 2007 19:37:08 -0400 |
Message-Id: | <200708302337.l7UNb83E010710@envy.delorie.com> |
From: | DJ Delorie <dj AT delorie DOT com> |
To: | djgpp AT delorie DOT com |
In-reply-to: | <TfIBi.37363$rr5.32521@newsfe1-win.ntli.net> |
(My_address AT end DOT of DOT post) | |
Subject: | Re: struct vs. typedef struct |
References: | <TfIBi.37363$rr5 DOT 32521 AT newsfe1-win DOT ntli DOT net> |
Errors-To: | nobody AT delorie DOT com |
X-Mailing-List: | djgpp AT delorie DOT com |
X-Unsubscribes-To: | listserv AT 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 |