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 7554 invoked from network); 27 Apr 2020 18:18:14 -0000 Received: from minnie.tuhs.org (45.79.103.53) by inbox.vuxu.org with UTF8ESMTPZ; 27 Apr 2020 18:18:14 -0000 Received: by minnie.tuhs.org (Postfix, from userid 112) id 7BDFB9C968; Tue, 28 Apr 2020 04:18:10 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id D22909B92D; Tue, 28 Apr 2020 04:17:42 +1000 (AEST) Received: by minnie.tuhs.org (Postfix, from userid 112) id B62DF9B92D; Tue, 28 Apr 2020 04:17:37 +1000 (AEST) X-Greylist: delayed 901 seconds by postgrey-1.36 at minnie.tuhs.org; Tue, 28 Apr 2020 04:17:37 AEST Received: from server907.appriver.com (server907a.appriver.com [204.232.250.39]) by minnie.tuhs.org (Postfix) with ESMTPS id 3260894895 for ; Tue, 28 Apr 2020 04:17:37 +1000 (AEST) X-Note: This Email was scanned by AppRiver SecureTide X-Note-AR-ScanTimeLocal: 04/27/2020 2:02:44 PM X-Note: SecureTide Build: 2/6/2020 4:08:38 PM UTC (2.8.16.0) X-Note: Filtered by 10.246.1.76 X-Note-AR-Scan: None - PIPE Received: by server907.appriver.com (CommuniGate Pro PIPE 6.2.12) with PIPE id 33471708; Mon, 27 Apr 2020 14:02:44 -0400 Received: from [10.246.0.39] (HELO smtp.us.exg7.exghost.com) by server907.appriver.com (CommuniGate Pro SMTP 6.2.12) with ESMTPS id 33471666; Mon, 27 Apr 2020 14:02:38 -0400 Received: from E16DN31A-S1E7.exg7.exghost.local (192.168.244.15) by E16DN31C-S1E7.exg7.exghost.local (192.168.246.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.0; Mon, 27 Apr 2020 14:02:29 -0400 Received: from E16DN31A-S1E7.exg7.exghost.local ([192.168.244.15]) by E16DN31A-S1E7.exg7.exghost.local ([192.168.244.15]) with mapi id 15.01.1979.000; Mon, 27 Apr 2020 14:02:29 -0400 From: Brantley Coile To: Noel Chiappa Thread-Topic: [TUHS] v7 K&R C Thread-Index: AQHWHLuyMfrm4ntfZkGQSIWWhns9L6iNhZ6A Date: Mon, 27 Apr 2020 18:02:29 +0000 Message-ID: References: <20200427174553.2801618C09B@mercury.lcs.mit.edu> In-Reply-To: <20200427174553.2801618C09B@mercury.lcs.mit.edu> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [47.46.143.102] x-rerouted-by-exchange: MIME-Version: 1.0 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-ID: <3C35B6076EFA7042B5E71A5C0ED919AD@fwd7.exghost.com> Content-Transfer-Encoding: quoted-printable X-Note: This Email was scanned by AppRiver SecureTide X-Note-AR-ScanTimeLocal: 04/27/2020 2:02:38 PM X-Note: SecureTide Build: 2/6/2020 4:08:38 PM UTC (2.8.16.0) X-Note: Filtered by 10.246.1.76 X-Policy: GLOBAL X-Primary: GLOBAL@coraid.com X-Note-Sender: X-Virus-Scan: V- X-Note-SnifferID: 0 X-GBUdb-Analysis: 0, 10.246.0.39, Ugly c=1 p=-0.986278 Source White X-Signature-Violations: 0-0-0-4415-c X-Note-419: 15.6235 ms. Fail:0 Chk:1357 of 1357 total X-Note: VSCH-CT/SI: 0-1357/SG:1 4/27/2020 2:02:35 PM X-Note: Spam Tests Failed: X-Country-Path: PRIVATE->PRIVATE-> X-Note-Sending-IP: 10.246.0.39 X-Note-Reverse-DNS: X-Note-Return-Path: brantley@coraid.com X-Note: User Rule Hits: X-Note: Global Rule Hits: G715 G716 G717 G718 G736 G737 G738 G893 X-Note: Encrypt Rule Hits: X-Note: Mail Class: VALID 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: , Cc: "tuhs@tuhs.org" Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" g, h and i are members of structures, the pointer of which is returned by t= he preceding function call. They have to be defined as pointers to function= s returning a pointer to the following structure.=20 A simple example is: typedef struct Node Node; struct Node { Node *(*f)(void); }; void main(void) { Node *p; =09 p->f()->f()->f(); call(); (*((*((*p->f)()->f))())->f)();=20 } // (*((*((*((*f)()->g))()->h))()->i))() > On Apr 27, 2020, at 1:45 PM, Noel Chiappa wrote= : >=20 >> From: Derek Fawcus >=20 >> I think he means something like: >> (*((*((*((*f)()->g))()->h))()->i))() >=20 > So I've been confused by this thread, and I'm hoping someone can deconfus= e me > - but I think I may have figured it out. >=20 > What's confusing me is that in C, the -> operator is followed by "an > identifier [which] designates a member of a structure or union object" (I > checked the spec to make sure my memory hadn't dropped any bits) - but g,= h > above are arguments; so I couldn't figure out what was going on. >=20 > I think what may have happened is that initially the discussion was about= C > ("Pretty sure it was not in v7 C"), but then it switched to C++ - with wh= ich > I'm not familiar, hence my confusion - without explicitly indicating that > change (although the reference to Bjarne Stroustrup should been a clue). = (And > that's why I thought "f()->g()->h()->i()" was ad hoc notation for "calls = f(), > then calls g()".) >=20 > Am I tracking now? >=20 > Noel >=20 >=20