home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ontek!mikey
- From: mikey@ontek.com (euphausia superba)
- Newsgroups: comp.lang.c
- Subject: Re: I disagree with lint(1)
- Keywords: lint, classic C
- Message-ID: <2134@ontek.com>
- Date: 8 Sep 92 21:12:09 GMT
- References: <1992Sep7.083401.2587@sci.kun.nl>
- Organization: Ontek Corporation -- Laguna Hills, California
- Lines: 58
-
- In comp.lang.c, hansm@cs.kun.nl (Hans Mulder) writes:
- | Hello C gurus,
- |
- | I just asked lint(1)'s opinion on this piece of code:
- |
- | typedef struct foo *bar;
- |
- | fun(b)
- | bar b;
- | {
- | b=b;
- | }
- |
- | struct foo
- | {
- | int i;
- | } the_struct;
- |
- | main()
- | {
- | fun(&the_struct);
- | return 0;
- | }
- |
- | Lint(1) says:
- |
- | fun, arg. 1 used inconsistently foo.c(5) :: foo.c(16)
- |
- | I disagree. The first argument to fun is a pointer to struct foo on both
- | lines. In my book, that's the same.
- |
- | What do you all think?
-
- I think lint is complaining not about the typedef, but because
- at the point where fun() is defined, "struct foo", and hence "foo *"
- are incomplete types. This should shut lint up:
-
- typedef struct foo *bar;
-
- struct foo
- {
- int i;
- } the_struct;
-
- fun(b)
- bar b;
- {
- b=b;
- }
-
- main()
- {
- fun(&the_struct);
- return 0;
- }
-
- the krill
-
-