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