Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!sri-unix!hplabs!hp-sdd!ncr-sd!ncrcae!sauron!wescott From: wescott@sauron.UUCP (Mike Wescott) Newsgroups: comp.lang.c++ Subject: Re: Bug in C++ cfont with possible fix (C++ v1.1) Message-ID: <773@sauron.UUCP> Date: Tue, 25-Nov-86 14:20:04 EST Article-I.D.: sauron.773 Posted: Tue Nov 25 14:20:04 1986 Date-Received: Wed, 26-Nov-86 09:48:50 EST References: <757@sauron.UUCP> <175@haddock.UUCP> Reply-To: wescott@sauron.UUCP (Mike Wescott) Organization: NCR Corp., Advanced System Development, Columbia, SC Lines: 28 In article <175@haddock.UUCP> karl@haddock.UUCP (Karl Heuer) writes: > In article <757@sauron.UUCP> wescott@sauron.UUCP (Mike Wescott) writes: > >While masked on the VAX, the bug can be demonstrated by the following: > >typedef int (* S)(float); extern S s; > >void x() { (*s)(4); s(4); } > >[...] > >Note first, that both methods of invoking the function pointers are > >legitimate C and C++. > > They are? I don't recall seeing this feature described in C++ (but I don't > have any recent documentation). And it is *not* legitimate oldC -- some > compilers will accept it, but not all. (It has, alas, been blessed by ANSI, > but the C++ compiler isn't supposed to generate ANSI C output, so the C++ > compiler is broken if it silently generates "s((float)4);". Right?) Within a day of posting this article, I cancelled it. For a more complete description of the probllem and a better fix, see <765@sauron.UUCP> and <766@sauron.UUCP>. And yes, it is C++ (see sect r7.1 of The C++ Programming Language, p. 256). And no it's not in K&R. As for the exact flavor of C that C++ ought to generate, I don't know. By the way, the fix posted in <766@sauron> produces "(*s)((float)4);" -- -Mike Wescott ncrcae!wescott