C Error on 4d/25 TGX, irix 3.2.1

Earl Baugh baugh at potomac.ads.com
Fri Jul 13 01:27:06 AEST 1990


Ok, I'm totally confused here...In the following code segment, 
why do I get the error messages that follow....why undefined p1 & p2?
I tried compiling the same source on a Sun (4.0.3) [though I had to 
change the prototype to the old style declaration] and two 
PC compilers and none of them had any problems, so why a problem
with the iris?  (I tried changing the prototype to an old style 
declaration and still had the same problem)

If there is some "C" knowledge I'm missing here, I'd like to 
know where to find out about it.....

---------------------------------Code test.c -------------------------------

#include <stdio.h>
#define TYPETABLESIZE 255

int  TypeHash(int code, void *p1, void *p2);

int  TypeHash (int code, void *p1, void *p2) 
{
     return (int) abs(((code * abs(((long)*p1+1)) * abs(((long)*p2+1))) % TYPETABLESIZE)) + 1;

} 

main()
{
	int a, b, c;

	a = 1;
	b = 2;
	c = 3;

  	TypeHash(a, (void *)&b, (void *)&c);  
}
-------------------------results of "make test"-----------------------------

	cc -O test.c  -o test
ccom: Error: test.c, line 8: p1 undefined
           return (int) abs(((code * abs(((long)*p1+1)) * abs(((long)*p2+1))) % 255)) + 1;
      ---------------------------------------------^
ccom: Error: test.c, line 8: illegal indirection
           return (int) abs(((code * abs(((long)*p1+1)) * abs(((long)*p2+1))) % 255)) + 1;
      ---------------------------------------------^
ccom: Error: test.c, line 8: p2 undefined
           return (int) abs(((code * abs(((long)*p1+1)) * abs(((long)*p2+1))) % 255)) + 1;
      ------------------------------------------------------------------^
ccom: Error: test.c, line 8: illegal indirection
           return (int) abs(((code * abs(((long)*p1+1)) * abs(((long)*p2+1))) % 255)) + 1;
      ------------------------------------------------------------------^
(ccom): test.c, line 8: cannot recover from earlier errors: goodbye!
      } 
      ^
*** Error code 1

Stop.
---------------------------------------------------------------------------


'Later-- 
	Earl D. Baugh Jr.
	Advanced Decision Systems
	Internet : baugh at ads.com



More information about the Comp.sys.sgi mailing list