[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC] Adding a real HashTable implementation to gnulib
From: |
Florian Weimer |
Subject: |
Re: [RFC] Adding a real HashTable implementation to gnulib |
Date: |
Fri, 04 Jan 2019 12:59:06 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
* Tim Rühsen:
> But I still wonder why
>
> - nested functions need an executable stack (why does the code have to
> be run on the stack ?)
The static chain pointer needs to be passed to the nest function, but
most ABIs only have a code pointer. So a trampoline is written to the
stack which sets up the static chain (in a hidden function argument) and
calls the implementation. The address of the trampoline is used as the
code pointer for the nested function.
> - there are no efforts to standardize either nested functions or blocks
> (clang has 'blocks' instead of nested functions) or both. (There is a
> C22 panel, but I couldn't find anything useful on their task list.)
You can simply use C++. C++11 and later have std::function and lambdas.
The standardization of lambdas for C has been abandoned, as far as I
know.
Thanks,
Florian