bam%hplsla@HPLABS.HP.COM (Ben Mejia) (11/24/88)
Version: gcc 1.31 compiled for hp9000/320. /* First bug: */ struct foo; /* warning generated on this "vacuous" declaration */ struct bar { struct foo* fp; }; struct foo { struct bar* bp; }; /* end of first bug */ gcc -c generates this warning: foo.c:1: warning: empty declaration This vacuous declaration shouldn't generate a warning message. The dpANS uses an equivalent example, illustrating the vacuous declaration usage. /* Second bug: */ int binky(struct bongo *p); /* no error generated here */ struct bongo { int ears; }; int binky(struct bongo *p) { p->ears = 1; } /* end of second bug */ gcc -c generates these errors: foo.c: In function binky: foo.c:11: conflicting types for `binky' foo.c:3: previous declaration of `binky' I found this entirely misleading. We found this bug in a large file with many nested includes. It *looked* like struct bongo was defined before both the function declaration and the function definition, but due to the nesting, it wasn't. The problem was easily rectified, but shouldn't the undefined "struct bongo" used in the function declaration generate at least a warning? I think it should be an error. Thanks, -- bam bam%hplsla@hplabs.hp.com (206) 335-2203 When confronted with a choice between two evils, I always choose the one I haven't tried before. -- Mae West