🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.acorn.tech
Article #330

C query.

#330
From: Philip R. Banks
Date: Thu, 15 Oct 1992 10:10
53 lines
2321 bytes
   Okay here is a little wee problem I am hoping some C type can answer for
me. Quickly please, before I take to this compiler with a blunt
instrument... :)

The problems is thus I have defined a structure like so :-

typedef struct {
   char *name;
   char *comment;
   struct filenode *next;
   struct filenode *prev;
   struct filenode *parent;
   struct filenode *sublist;
   int load;
   int exec;
   int length;
   char flag;
} filenode;

In the same file inside a procedure called AddNode I do the following :-

filenode *AddNode(char *name, filenode *parent, int type, char *comment) {
/* Adds a node to the sub list of the node passed as the parent. */
    filenode *newnode, *sublist;
    int namelength,commentlength;
    char *charblock1,*charblock2;
...
    if (sublist != NULL) {
       filenode *scratch;
       int flag;
...
             if ((*scratch).next != NULL) scratch->next->prev = (struct filenode *) newnode;

With the last line being the problem one. The compiler gives me the serious
error number 140 " 'struct filenode' not yet defined - cannot be selected
from ". Now given that the structure is defined in the *same* file I find
this a little hard to believe. Also the if statement is in the same scope as
the declaration of the variable scratch.

   So can anyone answer what I am doing wrong that the Norcroft compiler is
soooo helpfully not telling me? 

   I knew there was a good reason for sticking to Assembler. <mumble)
<mumble).

    Philip

--
Philip R. Banks  Syntax: mail < banks_p@kosmos.wcc.govt.nz >            @@@@@/|
                                                                        @@@@/#|
                                                                        @@@/##|
And who are we to criticize or scorn the the things that they do?       @@/---|
For we shall seek and we shall find Ammonia Avenue. ---A.P.P.           @/    |
Technical Details
Message-ID: <2qdtw7j025n@khantazi.welly.gen.nz>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!wupost!waikato.ac.nz!comp.vuw.ac.nz!cavebbs!tornado!khantazi!banksie

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!wupost!waikato.ac.nz!comp.vuw.ac.nz!cavebbs!tornado!khantazi!banksie
Newsgroups: comp.sys.acorn.tech
Subject: C query.
Message-ID: <2qdtw7j025n@khantazi.welly.gen.nz>
From: banksie@khantazi.welly.gen.nz (Philip R. Banks)
Date: Thu, 15 Oct 1992 23:10:41 +1300
Reply-To: banks_p@kosmos.wcc.govt.nz
Organization: My Arc.
Lines: 53