www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/01/30/22:24:04

Sender: nate AT cartsys DOT com
Message-ID: <36B3CA64.E91A25A@cartsys.com>
Date: Sat, 30 Jan 1999 19:13:40 -0800
From: Nate Eldredge <nate AT cartsys DOT com>
X-Mailer: Mozilla 4.08 [en] (X11; I; Linux 2.0.36 i586)
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: Forwards
References: <78vcvh$ctr$1 AT news DOT global DOT co DOT za>
Reply-To: djgpp AT delorie DOT com

Jason Filby wrote:
> 
> Hi all,
> 
> I do I forward declare something so that the following code compiles:
> 
> typedef struct _TESTOBJ TESTOBJ; /* Forward declaration??? */
> 
> typedef BOOL
>   (CALLBACK * FREEOBJPROC)
>   (TESTOBJ *pTestObj);
> 
> typedef struct _TESTOBJ
> {
>   FREEOBJPROC pFreeProc;
>   int abc;
> } TESTOBJ;

Something of the form

struct foo;

acts as a forward declaration.  So you can say:

struct _TESTOBJ;
typedef struct _TESTOBJ TESTOBJ;

and go from there.  Then just don't typedef it again (just declare
struct _TESTOBJ.)
-- 

Nate Eldredge
nate AT cartsys DOT com

- Raw text -


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