On 28/11/2023 10:51, Ed Robbins via Gcc-help wrote:
On Tue, 28 Nov 2023 at 07:21, Matthias Pfaller <leo@xxxxxxxx> wrote:
On 2023-11-27 16:16, Ed Robbins via Gcc-help wrote:
Hello,
I am using gcc-arm-none-eabi with a cortex M7 device, with caches
(data/instruction) enabled. Nested function calls result in a usage fault
because there is no clear cache call for this platform.
I have lots of code with nested functions. When switching to gcc-12 I got random
crashes on my cortex-m7 targets. In order to get that working again I had to patch
gcc/config/arm/arm.h:
Can I ask (either or both of you) why you are using are using nested
functions like this? This is possibly the first time I have heard of
anyone using them, certainly the first time in embedded development.
Even when I programmed in Pascal, where nested functions are part of the
language, I did not use them more than a couple of times.
What benefit do you see in nested functions in C, compared to having
separate functions? Have you considered moving to C++ and using
lambdas, which are more flexible, standard, and can be very much more
efficient?
This is, of course, straying from the topicality of this mailing list.
But I am curious, and I doubt if I am the only one who is.
David