liang@CS.UOREGON.EDU (03/10/90)
Mar, 9, 1990
I attempted to port a compiler written in C from Unix into PC for my
friend. When I compiled parser.c with Microsoft C 4.0, I got following
error message
"parser.c(167):warning 47: '=' : different levels of indirection"
Following is the code:
/* code in line 167 is final_ast = program(root); */
struct ast { /* abstract syntax tree */
int info;
int tval;
int ln;
struct ast *left;
struct ast *right;
};
struct ast *root, *final_ast;
:
:
final_ast = program(root); /* This is the line 167, error happen here */
:
:
:
struct ast *program(root) /* The declaration of function program */
struct ast *root;
{
:
:
:
}
If anyone knows the reason or how to fix it, please drop me a note
by email.
Thanks in advance.
Steve J. Zhang
email: liang@cs.uoregon.eduwittig@gmdzi.UUCP (Georg Wittig) (03/15/90)
liang@CS.UOREGON.EDU writes: > "parser.c(167):warning 47: '=' : different levels of indirection" ... > struct ast *root, *final_ast; ... > final_ast = program(root); /* This is the line 167, error happen here */ At that point, the type of ``program'' is not known to the compiler, so the default applies: ``program'' gets implicitly type ``function returning int''. Declare ``program'' before that line 167! -- Georg Wittig GMD-Z1.BI P.O. Box 1240 D-5205 St. Augustin 1 (West Germany) email: wittig@gmdzi.uucp phone: (+49 2241) 14-2294 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "Freedom's just another word for nothing left to lose" (Kris Kristofferson)