gentlemen,thing is as following: in Cmnd.c file, a struct is defined: typedef struct { unsigned char arg1; unsigned char arg2; unsigned char arg3; unsigned int arg4; unsigned int arg5; }para; and then three para type variables: para data Strt1,Strt2,Strt3; and I have 2 place where the para type variables are accessed. in Reset.c file,three routines: ResetParse(para data*data StructPtr); ColdReset(para data*data StructPtr); HotReset(para data*data StructPtr); compile,pass. but in another file Cmnd.c where the para is defined. It just doesnt work:( the routine ExeCmnd(uint len,uchar xdata*data Cmnd,para data*data StructPtr); compile,an err occurs;( CMND.C(24): error C141: syntax error near 'data', expected ')' and if I change it to this: ExeCmnd(uint len,uchar xdata*data Cmnd,uchar data*data StuctPtr); compile,done! faint,anybody help me,and tell me what's going on:( I thought it was probably coz there are too many parameters than 3 parameters that couldb be passed thru registers,but I change parameters number,not yet work:(, then I come here for help, the basic project setup is: mcu: Ram 256, large mode, and nothing special; thanks in advance:) ---going to mad:(
sorry,I got it;( so simple and easy:) the Cmnd.c has a header file. Cmnd_Header.h it was like this: typedef struct { unsigned char arg1; unsigned char arg2; unsigned char arg3; unsigned int arg4; unsigned int arg5; }para; but I change this header file,delete the corresponding code,and put this code in Cmnd.c file. so the problem comes. I made a stupid mistake:(,my declaration of Cmnd(uint,uchaar *,para *) is before the para definition:(, Jesus Christ,how stupid I was:(,what a stupid and unforgivable mistake:(, but just thanks to everybody here:)
"Jesus Christ,how stupid I was:(,what a stupid and unforgivable mistake" Take it easy, we *all* make stupid mistakes from time to time.
ResetParse(para data*data StructPtr); Formal parameters do not have a memory space declaration. The parameters themselves are passed in registers, or spilled out to memory as the compiler decides. A pointer can point to a particular memory type, but the pointer itself is the formal parameter, and would not have a memory type. So, I could have void MyFunc (U8* p); // U8 lives anywhere; 3-byte generic pointer void MyFunc (U8 data* p); // the U8 must live in data space void MyFunc (U8 xdata* p); // the U8 must live in xdata space but not void MyFunc (U8* data p); // BUGGED: p itself must be put in data space? void MyFunc (U8* xdata p); // BUGGED: p itself must be in xdata space?