Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!ima!haddock!karl From: karl@haddock.UUCP Newsgroups: comp.lang.c++ Subject: Re: Bug in C++ cfont with possible fix (C++ v1.1) Message-ID: <175@haddock.UUCP> Date: Sat, 22-Nov-86 10:44:15 EST Article-I.D.: haddock.175 Posted: Sat Nov 22 10:44:15 1986 Date-Received: Sun, 23-Nov-86 03:14:54 EST References: <757@sauron.UUCP> Reply-To: karl@haddock.UUCP (Karl Heuer) Organization: Interactive Systems, Boston Lines: 15 Summary: avoid calling function pointer as if it were a function 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?) Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint