Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/5/84; site python.UUCP Path: utzoo!watmath!clyde!burl!ulysses!gamma!epsilon!zeta!sabre!python!michael From: michael@python.UUCP (M. Cain) Newsgroups: net.lang.c Subject: Re: how has C bitten you? Message-ID: <174@python.UUCP> Date: Fri, 16-Aug-85 09:26:09 EDT Article-I.D.: python.174 Posted: Fri Aug 16 09:26:09 1985 Date-Received: Mon, 19-Aug-85 08:29:53 EDT Organization: Bell Communications Research Lines: 39 This one didn't bite me directly, but my wife spent most of a day finding a more complicated instance of it in someone else's code. Start with two source files: foo.c: main() { sub2(1); } sub1() { } bar.c: extern sub1(a,b); sub2(x) int x; { printf("a = %d, b = %d, x = %d\n",a,b,x); } Compiling with "cc foo.c bar.c" produced no error messages at all. But when a.out is executed, the output was a = 1, b = junk, x = junk This was all done under XENIX on a Sritek 68000 board. Same kind of screw-up in both AT&T and Berkeley universes on a Pyramid. Lint on the Pyramid complains that sub2() has a variable number of argu- ments. Two different 68000 cross-compilers make the same mistake. Our VAX running System V correctly tagged the extern statement as incorrect. My 6809 OS-9 system missed the extern statement, but at least pointed out that a and b are undefined within sub2(). Michael Cain Bell Communications Research ..!bellcore!python!michael