[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

see below



Posted for Gary Desrochers

Date: Sat, 13 Feb 1993 10:40:30 -0700
From: gdesroch@slate.Mines.Colorado.EDU (DESROCHERS GARY FREDERIC)

Subject: Illegal use of forward declaration (ORCA/C)
Newsgroups: comp.sys.apple2
Distribution:
Organization: Somewhere over the rainbow

     O.K.  Here is the problem.  This is not with the newest version of
ORCA/C.  Can anyone tell me what is wrong here.  The errors I get are
Illegal use of forward declaration.  It took me a while to narrow it down
to that it is a pointer within a struct.  I did create this though.

     Let me say it now.  This does work on an RS/6000 and a SUN
workstation.  It just doesn't work within ORCA/C.  It should.

     The error does not allow for you to get anything out of it so it
really doensn't do much.  I haven't narrowed it down any further but I
know that this should not be giving an error.

     I would like to have anyone try it out and see what they think.
Also since I am getting ORCA/C version 2.0 in, could someone with it test
it with the new version of ORCA/C and see what it tells them.

/* This is the file named defs.h */

typedef union Acombination *mycombo;
struct Anotherblock{
       int someint;
       char somechar;
       struct Ablock * someblock;
       };
struct Ablock{
       int someint;
       char somechar;
       };
union Acombination{
      struct Ablock ablock;
      struct Anotherblock anotherblock;
      };

/* Here starts the file main.cc */

#include "defs.h"
main(){
      mycombo avar,anovar;
      struct Ablock anblock, secblock;
      struct Anotherblock anoblock, secoblock;

      /* The line below should give an error to you. */
      anoblock.someblock = &anblock;
      /* The line below should give an error to you. */
      secoblock.someblock = &secblock;
      avar = (mycombo)&anoblock;
      anovar = (mycombo)&secoblock;
      /* The line below should give an error to you. */
      avar->anotherblock.someblock = (anovar->anotherblock.someblock);
}