[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: nested functions

From: Bruno Haible
Subject: Re: nested functions
Date: Thu, 03 Jan 2019 18:10:47 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-141-generic; KDE/5.18.0; x86_64; ; )

[Not sure this is the right forum. Maybe stackoverflow.com would be a better
 place to discuss this.]

Tim Rühsen wrote:
> BTW, nested functions are pretty nice to use.
> But I still wonder why
>  - nested functions need an executable stack (why does the code have to
> be run on the stack ?)

Because in most ABIs, a function pointer is a pointer to the first instruction.
The notable exceptions are:
  - PowerPC and PowerPC64 with AIX ABI,
  - ia64
  - hppa, hppa64.

>  - there are no efforts to standardize either nested functions or blocks
> (clang has 'blocks' instead of nested functions) or both.

As far as I understand, this [1] would be a profound change of the C language.
Possibly people feel that C shouldn't evolve in an uncontrolled and crazy way
like C++ does...


[1] https://en.wikipedia.org/wiki/Blocks_(C_language_extension)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]