Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connections
Warning: mysqli::query(): Couldn't fetch mysqli in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\index.php on line 66
Article <uv5e3l$q885$1@dont-email.me>
Deutsch   English   Français   Italiano  
<uv5e3l$q885$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!weretis.net!feeder6.news.weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: David Brown <david.brown@hesbynett.no>
Newsgroups: comp.lang.c
Subject: Re: Recursion, Yo
Date: Wed, 10 Apr 2024 09:11:49 +0200
Organization: A noiseless patient Spider
Lines: 31
Message-ID: <uv5e3l$q885$1@dont-email.me>
References: <uut24f$2icpb$1@dont-email.me> <uutqd2$bhl0$1@i2pn2.org>
 <uv2u2a$41j5$1@dont-email.me> <87edbestmg.fsf@bsb.me.uk>
 <uv4r9e$mdd3$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 10 Apr 2024 07:11:50 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="7a89ab18d1e4b124320c42cc3e6d2a2d";
	logging-data="860421"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+b6AmkLiEt1qMLoewsSRVoHhUYbkXWUzE="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.11.0
Cancel-Lock: sha1:7cfAs1Yj+A7hFVg1YucpE3xV0UA=
Content-Language: en-GB
In-Reply-To: <uv4r9e$mdd3$1@dont-email.me>
Bytes: 2783

On 10/04/2024 03:50, Lawrence D'Oliveiro wrote:
> On Tue, 09 Apr 2024 11:44:23 +0100, Ben Bacarisse wrote:
> 
>> It's significant (or at least note worthy) that the code in the
>> original post was not ISO C ...
> 
> Interesting that GCC’s C compiler allows nested routine definitions,
> but the C++ compiler does not.

It is an old extension, going back to when gcc barely (if at all) 
supported C++.  The compiler middle-end had to have support for nested 
functions for languages like Pascal, Module 2 and Ada (I believe Ada is 
the only one of these that stuck around in gcc mainline, but other 
language front-ends have been made outside the main tree).  Someone 
thought it might be a useful feature in C too, and perhaps something 
that would catch on in the standards (several early gcc extensions ended 
up standardised in C99).

It is not much used in practice, AFAIK.  For some cases the code 
generation for nested functions was fine and straight-forward.  In other 
cases, however, it required a trampoline generated on the stack, and 
that became a real pain once non-executable stacks came into fashion.

Nested functions were never as interesting for C++ as you already have 
better mechanisms for controlling scope and data access - classes and 
their methods, including nested classes.  And once lambdas joined the 
party in C++11 there was absolutely no reason to have nested functions - 
there is nothing (AFAIK) that you could do with nested functions that 
you can't do at least as well, and often better, with lambdas.