bruno@sdcc10.ucsd.EDU (Bruce W. Mohler) (07/29/89)
Environment: Compaq 386/20 running Xenix 2.3.1 with 2.2 Dev Sys Compiling NetHack 3.0 yields a compile-time error in the file objnam.c line 160. This is the message: objnam.c(160) func: not a function This is the function in question: >> /* Give the name of an object seen at a distance. Unlike xname/doname, >> * we don't want to set dknown if it's not set already. The kludge used is >> * to temporarily set Blind so that xname() skips the dknown setting. This >> * assumes that we don't want to do this too often; if this function becomes >> * frequently used, it'd probably be better to pass a parameter to xname() >> * or doname() instead. >> */ >> char * >> distant_name(obj, func) >> register struct obj *obj; >> char *(*func) P((struct obj *)); >> { >> char *str; >> >> long save_Blinded = Blinded; >> Blinded = 1; >> str = func(obj); <---- this is the offending line >> Blinded = save_Blinded; >> return str; >> } I'd appreciate any help in getting past this point since the declaration of func is not intuitive (even with cdecl's help). -- Bruce W. Mohler Systems Programmer (aka Staff Analyst) bruno@sdcc10.ucsd.edu voice: 619/586-2218
bruno@sdcc10.ucsd.EDU (Bruce W. Mohler) (07/29/89)
In article <129@sdcc10.ucsd.EDU>, bruno@sdcc10.ucsd.EDU (Bruce W. Mohler) writes: > Environment: Compaq 386/20 running Xenix 2.3.1 with 2.2 Dev Sys > > Compiling NetHack 3.0 yields a compile-time error in the > file objnam.c line 160. This is the message: > > objnam.c(160) func: not a function > > This is the function in question: > Boy, talk about *good* response time! It was only an hour or two after I'd submitted my article that Janet Walz (walz@mimsy.umd.edu) was back to me with a fix! (Here it is:) -=- As multiple other people running Xenix have observed, func is a function -=- pointer, not a function, which is fine with ANSI compilers and pcc but not -=- Xenix. Use -=- str = (*func)(obj); -=- -=- Thanks again, Janet! Maybe SCO will have this fixed in their new Dev System... -- Bruce W. Mohler Systems Programmer (aka Staff Analyst) bruno@sdcc10.ucsd.edu voice: 619/586-2218