home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / c / 19358 < prev    next >
Encoding:
Text File  |  1993-01-07  |  1.3 KB  |  49 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!darwin.sura.net!udel!louie!eplrx7!eplrx7.es.dupont.com!hanafey
  3. From: hanafey@eplrx7.es.dupont.com (Mike Hanafey)
  4. Subject: "const" Parameter compatibility 
  5. Message-ID: <1993Jan7.154448.19249@eplrx7.es.duPont.com>
  6. Keywords: prototypes const
  7. Sender: nntpuser@eplrx7.es.duPont.com (NNTP user)
  8. Nntp-Posting-Host: zip
  9. Organization: DuPont Central Research & Development
  10. Date: Thu, 7 Jan 1993 15:44:48 GMT
  11. Lines: 36
  12.  
  13. Are the compiler messages below a bug, or is this correct ANSI C? Also,
  14. the lack of a warning on line 20 appears inconsistent with the warnings
  15. for lines 15 and 16.
  16.  
  17. "test.c", line 15: warning: argument is incompatible with prototype: arg #1
  18. "test.c", line 16: warning: argument is incompatible with prototype: arg #1
  19.  
  20.      1  int funca(const int **a) {
  21.      2      return **a;
  22.      3  }
  23.      4  
  24.      5  int funcb(const int *a) {
  25.      6      return *a;
  26.      7  }
  27.      8  
  28.      9  main(void) {
  29.     10      int *b;
  30.     11      int **bp;
  31.     12      const int *c;
  32.     13      const int **cp;
  33.     14  
  34.     15      (void) funca(&b);
  35.     16      (void) funca(bp);
  36.     17      (void) funca(&c);
  37.     18      (void) funca(cp);
  38.     19  
  39.     20      (void) funcb(b);
  40.     21      (void) funcb(c);
  41.     22  
  42.     23      return 0;
  43.     24  }
  44.  
  45.  
  46. Mike Hanafey
  47. hanafey@suncity.es.dupont.com
  48. -- 
  49.