From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by sourceware.org (Postfix) with ESMTPS id C7A213858C54 for ; Wed, 6 Dec 2023 07:43:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C7A213858C54 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C7A213858C54 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::232 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701848592; cv=none; b=LlqPPyAx62CPKIPyrE8HgH6HCqC6/7DC3VlPq7IrRI8MPJmF2RkG46pMZt0OspGoEYm44IL7vzgpypHC0Je53WTQ2LdfNpif5PcYrLCfDIiSKkCyb+LkMcTbiquDrurzD7jRKj0eoYutPJinzLRZ10Bi/Xr44pV+C36VaSwAldI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701848592; c=relaxed/simple; bh=WwqYtH6cjdBMhdC1OvkZhSpMU+AKtetpRTmh5Wvcs1E=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=UVLUxwcr9BmPL2KcZh0PZ6I3WpyZhoEmU8R8wuDg++pvvzRTyDeGX6JLbss/pqMT9iih94tXQyFW9VYu+nqosiH+upegthwRe0fzPaTh5U8G2po0A74iQDwI/6cqvzkPnexF0bEIw5V9iSVOglmKj+JcN8cUr4XHAv5Z5LHRWvg= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2c9f85eff28so55486031fa.3 for ; Tue, 05 Dec 2023 23:43:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701848589; x=1702453389; darn=gcc.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=LMbNXFAxYAsN7qGKwu8zQXEBbnRZLfPvnu2+V63UQJ4=; b=c2E6i7Ei0kTkfpFu+fswYoZYGJD5w2LkIa6B/9NWEWdDEGkUvcKgWmlVt8xGF79+p/ NBKXQ1VGX6ZxM7sNIDRQrLLmxWHLY4I4WkeEKgBrWniPYr7fvJ9iIFkqxyuhoCTPVGri w8TCXtKVINjFhsWUA6RFNH1bBnAl5vVv7s1jKuIXctEB41y0Sa5/DbHvp1cXpltpinIM Ww1exnmI+AHarWJfokfSUIui17eB5U2IK0xxyssTVBW0Gs0uI7Qy6rLOnjfOLwsdG/qG egbgjZD1aT2ArXBIbLjIigBkDIDFiMqGxSAS1HPlXVJQbfI0jh6uBb5mF0ZOdM1Xi5n7 y9Pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701848589; x=1702453389; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LMbNXFAxYAsN7qGKwu8zQXEBbnRZLfPvnu2+V63UQJ4=; b=En7Ist6qlwQbSD2Ozyb7oqA86ypklD0mVZ4+yHIcjIaI+OaS2OV24XgkWFfzkM6rg4 1RxxS2QdLMzAdlx8L4i3PL9giMfOrRCkud2cTMRaYZSLh9FQBvNJE4PmpRqlT28eZl7U nT8ZyIEn7dbRMDBxqfkItQeFtecjgDhYTN8mmKObz5w8ybVgCk5cL+sGuhcZaotLxpDI i1+A8+M/iQWixpgdiSP0mguirkuv7PJ9QbjcPxjMWaKw9qc5fzcG/HFheU+MaYyTmhgr 1Qmv1UZnFzWS+hIY+zTGyIMKPl+bN0jKAkm5zRu3ljd+PoLKabbCIgUlymSLhWAcFrFJ JB6g== X-Gm-Message-State: AOJu0YyWnb7ngMfX98EEXYxxAsdkJK+4mK1cQZYzMEiahMoE8LNftDZI jgqw3M0G6fvQ3oVfu5s3+ZwVvxs/w1K1DX8iO8E= X-Google-Smtp-Source: AGHT+IFySaZtxR0k9gagHUNbOrnyb+Rvm614hR8c55qSEKuFTZycnYcI7GqpFgnSCeyWFqgtHvjeCllgCOLjx6X+XMg= X-Received: by 2002:ac2:514f:0:b0:50b:ea3f:8f88 with SMTP id q15-20020ac2514f000000b0050bea3f8f88mr314137lfd.108.1701848588959; Tue, 05 Dec 2023 23:43:08 -0800 (PST) MIME-Version: 1.0 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> <619f96c1-0da-21e6-446f-2541b593e0aa@codesourcery.com> <202bfa4a608cd28481bee80d7cec64d1037ec9f7.camel@tugraz.at> <3a9ef46418f9a6916e70ee6aef297a540e936c1c.camel@tugraz.at> In-Reply-To: <3a9ef46418f9a6916e70ee6aef297a540e936c1c.camel@tugraz.at> From: Richard Biener Date: Wed, 6 Dec 2023 08:39:11 +0100 Message-ID: Subject: Re: [gcc15] nested functions in C To: Martin Uecker Cc: Joseph Myers , Siddhesh Poyarekar , Andreas Schwab , polacek@redhat.com, gcc-patches@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,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 Tue, Dec 5, 2023 at 10:16=E2=80=AFPM Martin Uecker wr= ote: > > Am Dienstag, dem 05.12.2023 um 21:08 +0000 schrieb Joseph Myers: > > On Mon, 4 Dec 2023, Martin Uecker wrote: > > > > > > The key feature of lambdas (which failed to make it into C23) for t= his > > > > purpose is that you can't convert them to function pointers, which > > > > eliminates any need for trampolines. > > > > > > And also makes them useful only for template-like macro programming, > > > but not much else. So my understanding was that this needs to be > > > addressed at some point. > > > > Where "addressed" probably means some kind of callable object that stor= es > > more than just a function pointer in order to be able to encapsulate bo= th > > the code address of a lambda and the context it needs to receive > > implicitly. So still not needing trampolines. > > Yes, a wide function pointer type similar to C++'s std::function. > > This would also be a way to eliminate the need for trampolines > for GCC's nested function. And conversion to ordinary function pointer types would be still possible by using (on heap) trampolines then and would offer backward compatibility. I wonder how much implementation work would it be to add the wide function pointer types (please hide details in the C frontend). Richard. > Martin > > >