home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / std / c / 2364 < prev    next >
Encoding:
Text File  |  1992-07-25  |  1.6 KB  |  46 lines

  1. Newsgroups: comp.std.c
  2. Path: sparky!uunet!sun-barr!cs.utexas.edu!torn!newshost.uwo.ca!newshost.uwo.ca!oink
  3. From: oink@newshost.uwo.ca (Test Account)
  4. Subject: Function Prototypes: Don't they force casts?
  5. Organization: The University of Western Ontario, London, Canada.
  6. Date: Sun, 26 Jul 1992 08:22:12 GMT
  7. Message-ID: <OINK.92Jul26032212@julian.newshost.uwo.ca>
  8. Sender: news@julian.uwo.ca (USENET News System)
  9. Nntp-Posting-Host: julian.uwo.ca
  10. Lines: 34
  11.  
  12. Howdy:
  13.     While I was completeing the port of my application to ANSI-C, I came
  14. across this:
  15.  
  16. #include <signal.h>
  17. #include "myproto.h" /* This included many prototypes, but of particular
  18. interest here is: void memory_fault(void); */
  19.  
  20. [...]
  21.  
  22.     if ((int) signal(SIGSEGV, memory_fault) < 0) {
  23.         perror("Trouble initializing SEGV routine");
  24.         exit(-1);
  25.     }
  26.  
  27. Under AIX 3.2 using c89, this produces a diagnostic about incompatible types:
  28. int and pointer (don't have the exact text handy, but I hope you get the
  29. idea). This occurs IFF memory_fault() is declared AFTER its use or in another
  30. module, if it is declared before its use there is no diagnostic. The fix is
  31. simple, ((void *) memory_fault) works fine but I THINK that it is unnecessary.
  32.  
  33. Now I know that a conforming implementation is allowed to issue any spurious
  34. diagnostics that it wishes to but ...
  35.  
  36. Am I all wet here or should I make a call to IBM to ask for a fix (I mean, it
  37. made me wonder whether the prototypes were being used at all (they are)).
  38.  
  39. what say you?
  40.  
  41. cheerskinch
  42. Dave Kinchlea        kinch@betty.csd.uwo.ca (reply will (should) work)
  43. Computer Science Dept.
  44. University of Western Ontario
  45. London, Ontario, Canada
  46.