Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!wuarchive!decwrl!ads.com!potomac!baugh From: baugh@potomac.ads.com (Earl Baugh) Newsgroups: comp.sys.sgi Subject: C Error on 4d/25 TGX, irix 3.2.1 Message-ID: <8903@potomac.ads.com> Date: 12 Jul 90 15:27:06 GMT Organization: Advanced Decision Systems, Arlington VA Lines: 63 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 #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@ads.com