delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2007/08/30/19:30:22

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
Subject: struct vs. typedef struct
Lines: 41
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: <TfIBi.37363$rr5.32521@newsfe1-win.ntli.net>
Date: Thu, 30 Aug 2007 23:19:15 GMT
NNTP-Posting-Host: 86.13.154.18
X-Complaints-To: http://netreport.virginmedia.com
X-Trace: newsfe1-win.ntli.net 1188515955 86.13.154.18 (Fri, 31 Aug 2007 00:19:15 BST)
NNTP-Posting-Date: Fri, 31 Aug 2007 00:19:15 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

Folks,

I'm not sure whether this is a DJGPP question or a C question, but I think 
the problem is due to the single-pass compilation of DJGPP.

If I make a struct...

struct S
{ int x;
   int y;
   struct S *next;
}

... it compiles fine.  I believe that DJGPP is a single-pass compiler, so 
when it sees *next, it already knows
what struct S is.

If I try to compile...

typedef struct
{ int x;
  int y;
  S *next;
} S;

... the compiler doesn't like it, I guess because when it encounters *next, 
it hasn't seen the reference to S yet.

Is there a way around it?

Thanks,

MikeC.
-- 
Mental decryption required to bamboozle spam robots:

mike_best$ntlworld*com
$ = @
* = dot 


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019