From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: (qmail 387 invoked from network); 27 Apr 2020 13:20:16 -0000 Received: from minnie.tuhs.org (45.79.103.53) by inbox.vuxu.org with UTF8ESMTPZ; 27 Apr 2020 13:20:16 -0000 Received: by minnie.tuhs.org (Postfix, from userid 112) id EDB5D9C8AE; Mon, 27 Apr 2020 23:20:14 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id 43D389B92D; Mon, 27 Apr 2020 23:19:30 +1000 (AEST) Received: by minnie.tuhs.org (Postfix, from userid 112) id AC8609B92D; Mon, 27 Apr 2020 23:19:26 +1000 (AEST) Received: from ppsw-40.csi.cam.ac.uk (ppsw-40.csi.cam.ac.uk [131.111.8.140]) by minnie.tuhs.org (Postfix) with ESMTPS id 9E16B94895 for ; Mon, 27 Apr 2020 23:19:25 +1000 (AEST) X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://help.uis.cam.ac.uk/email-scanner-virus Received: from grey.csi.cam.ac.uk ([131.111.57.57]:35330) by ppsw-40.csi.cam.ac.uk (ppsw.cam.ac.uk [131.111.8.138]:25) with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1jT3fQ-0004j4-jD (Exim 4.92.3) for tuhs@tuhs.org (return-path ); Mon, 27 Apr 2020 14:19:24 +0100 Date: Mon, 27 Apr 2020 14:19:23 +0100 From: Tony Finch To: The Eunuchs Hysterical Society In-Reply-To: Message-ID: References: <6D6EFA0C-36C3-4225-A331-D1998A07C50A@gmail.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Subject: Re: [TUHS] v7 K&R C X-BeenThere: tuhs@minnie.tuhs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: The Unix Heritage Society mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" Rob Pike wrote: > The ability to call a function pointer fp with the syntax fp() rather than > (*fp)() came rather late, I think at Bjarne's suggestion or example. Pretty > sure it was not in v7 C, as you observe. I've seen some interesting discussion about Dave Horsfall's favourite retro-C definition of abort(): int abort 4; ... abort(); https://minnie.tuhs.org/pipermail/tuhs/2020-March/020680.html In particular a lot of people didn't know that function pointers could not be called like abort() so they didn't realise that 4 was the machine code contents of the function, not the address of the function. (Extra confusing since branching to address 4 was also a plausible way to crash the program...) But that made me wonder what 7th-and-earlier C would do if you tried to call a local variable. I guess that would lead to the compiler saying error("Call of non-function"); Tony. -- f.anthony.n.finch http://dotat.at/ Hebrides, Bailey, Fair Isle, Faeroes: Northeasterly 4 to 6, occasionally 7 at first in north Fair Isle. Moderate or rough. Showers. Good, occasionally moderate.