On Mon, 4 Dec 2023, Siddhesh Poyarekar wrote: > On 2023-12-04 13:48, Martin Uecker wrote: > > > I empathize with Jakub's stated use case though of keeping the C > > > frontend support for testing purposes, but that could easily be done > > > behind a flag, or by putting nested C func deprecation behind a flag. > > > > I am relatively sure C will get some form of nested functions. > > Maybe as anonymous nested functions, i.e. lambdas, but I do > > not see a fundamental difference here (I personally like naming > > things for clarity, so i prefer named nested functions) > > 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 key feature of lambdas (which failed to make it into C23) for this purpose is that you can't convert them to function pointers, which eliminates any need for trampolines. -- Joseph S. Myers jos...@codesourcery.com