From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from skyblue.cherry.relay.mailchannels.net (skyblue.cherry.relay.mailchannels.net [23.83.223.167]) by sourceware.org (Postfix) with ESMTPS id BD5A33858C2A for ; Tue, 5 Dec 2023 12:32:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BD5A33858C2A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gotplt.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gotplt.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org BD5A33858C2A Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=23.83.223.167 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1701779552; cv=pass; b=sNBZhyUv87e4dBwdgL5WbuP2NdcMFLNSsbSDWJYHkqNV/36N5Z+Ke4fHE4QVTCwtaN6tI/syw8VxIjkmMCbeIRm2UKqst8QhLoc0LyijWOh+zYpqcUDPOMBZ7nx7evlw1nHnP6LQF5vGFPS812dEI9qpl9II7xRwRr6YPH0xtk4= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1701779552; c=relaxed/simple; bh=xpesM/nZh4oDXtCl3EWshq0KEpw4fSF/y0RPZfBj9C4=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=SiJG4lJ+9e+17mL2lg5vAnGJ4R9t8LY9jhf3EMPGrJLyIeV4NFykD2qRHMU+mIUQT3OQ5wAoDfUMMrgGbomv9WOk29HEtQ/R/S7GuLd4ZnfLaa23dxcwcLacaBUlk42VDo8urJj4gTLz2IPkTQ0RdzSMdGC9QQDVFel6fzAXwhs= ARC-Authentication-Results: i=2; server2.sourceware.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id C574E94291A; Tue, 5 Dec 2023 12:32:29 +0000 (UTC) Received: from pdx1-sub0-mail-a283.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 674BA942C1E; Tue, 5 Dec 2023 12:32:29 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1701779549; a=rsa-sha256; cv=none; b=Y8NTOAKGvL35rtTB0z4D7dwDfxBfdXLNtNkYLLXLIf2sgC3IzgBjhtDpBpD9yPACN8m4De ZhGBvg/caxWJCAtdMv7TwXo5lkxm+sxCkeI7RpUCgr5jHLy6Qna2jPhdiIXdz/6L+yF3r1 u+bm+tLv6ky35Rotkb50YuE1dAX/Avhwr4NC3iJKyAVF2cNTSdNwemLDZa7tDU5b4wf6+c aoIv99Qb6TCoFO8braLpPe/4K5uIxXUB6mZJIIw4W7aM60M1nxhA0wvy7hJ+IdIGPvmikI fUGCARBD2rAGffUZQ94W2HITgusWiivCNkaDss+/c1cthV5AhR4WdJ2vwegOng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1701779549; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=i0mVS4EFiZoiw1oRTVVNKgIeukBElhl6LWS+S4yqu1o=; b=UIJ1mLofkfxQmdGXJOtKJRLz8DEfFHspE6Bj9OCgrdfzHj+uwVHTSPCqpcwqOOSEuAn0/U TtJLpSj0fZsRGaaXyRfnqefPvkETGmxYcrIPTmWfXFq2Y+hA4imruN/blOV1xZcaZwyMIV U7hFrSnME0AMVToqGx3BpKL6MYBbFUWMe6BoqDdYjRSEaUrqM7eJkVKVoYNMxeG6UX6M60 2RTV/xuMsDqHfb70Si00jyY1heN7I65CBFVzrCofavXJU7KZkoLLm9u/Sj8BH5SzlUvImh SRmXMLVzVxjdojF57UarW87N/iVYlZ53AuTo4Dznd+BwIvh9U/Vz7QnJf1q/ug== ARC-Authentication-Results: i=1; rspamd-696ff67dc8-hrqnc; auth=pass smtp.auth=dreamhost smtp.mailfrom=siddhesh@gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Interest-Vacuous: 25d62fb8265187d9_1701779549561_3860070538 X-MC-Loop-Signature: 1701779549561:2887994912 X-MC-Ingress-Time: 1701779549560 Received: from pdx1-sub0-mail-a283.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.126.216.6 (trex/6.9.2); Tue, 05 Dec 2023 12:32:29 +0000 Received: from [192.168.2.12] (bras-vprn-toroon4834w-lp130-02-142-113-138-136.dsl.bell.ca [142.113.138.136]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a283.dreamhost.com (Postfix) with ESMTPSA id 4Sl0Km5ynpzdQ; Tue, 5 Dec 2023 04:32:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gotplt.org; s=dreamhost; t=1701779549; bh=i0mVS4EFiZoiw1oRTVVNKgIeukBElhl6LWS+S4yqu1o=; h=Date:Subject:To:Cc:From:Content-Type:Content-Transfer-Encoding; b=Excmk5nitBXtFVuU0M147+xTVS9V3ZKHxvVYYO2tdXe7LxHdvyE3gwtxOdhnRyXZI elPIW1BPdB0+ichZlh+KEMjx1AvCBHKHZU1g1Ip+uyxQQ2+mHdeZiSgTdPeUVkmzcJ MnlyRzasoj9XtDdlkg7SR1cSulEF3+jN4mAiBpv8v1SMkMF9sSZ5p+tAqnpLU4xkRk dwdmQuG45tzZnbbuQY2ZBYJQ1eK4WeoZSepB4UadPUucH/Ot2mqNb7t3ig0KlvpdZs XsRrVXCwwY7KJx35BNVV83RxxmuxYmIaBmsX5U12I75mewZj+osmhE4r4QS0Y0wov4 7YI01YnyBvfNg== Message-ID: <44261dd0-d4ec-4b8e-8338-60825ca87724@gotplt.org> Date: Tue, 5 Dec 2023 07:32:27 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [gcc15] nested functions in C Content-Language: en-US To: Martin Uecker , Andreas Schwab Cc: polacek@redhat.com, gcc-patches@gcc.gnu.org References: <7862c488-5afd-4018-9dc5-c72d9382a052@gotplt.org> <48690099bc3fb6030191d2c58525fcfc415da107.camel@tugraz.at> <3b959c8a-0a65-4185-a943-122bb898796f@gotplt.org> <90f24d27f63622b90166f43a3648e41c7c911c90.camel@tugraz.at> <81ebaa59-ada2-4ba4-b03e-5f7247b2fe5b@gotplt.org> <30bf8bb5c7fa08344c39b23e4249d7df69f2bb26.camel@tugraz.at> From: Siddhesh Poyarekar In-Reply-To: <30bf8bb5c7fa08344c39b23e4249d7df69f2bb26.camel@tugraz.at> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3030.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 2023-12-04 16:31, Martin Uecker wrote: >> If (assuming from them being called lambdas) they are primarily for >> small functions without side-effects then it's already a significantly >> stronger specification than what we have right now with C nested >> functions. That would end up enforcing what you demonstrate as the good >> way to use nested functions. > > The proposal we have seen for C23 (which was not accepted into > C23 mostly due to timing and lack of implementation experience) > were similar to C++'s lambdas and did not have any such restriction. Oh well :/ >> If nested functions are eventually going to make it into the C standard >> then effort is probably better spent in porting the C nested functions >> to use descriptors instead of executable stacks or heaps. > > I submitted a patch for this a long time ago which was based > on the code for Ada that uses a bit in the pointer to differentiate > between conventional pointers and descriptors. > > I would now prefer an approach that uses a qualifier on the > function type to indicate that the static chain has to be > set. A pointer to such a qualified function would a descriptor > that consists of the address and the value for the static chain. > > This would be useful for many things. Ack, this probably becomes a gcc15 thing then, given that stage 1 has closed. Are you planning to revive your work and repost? Thanks, Sid