Date: Fri, 21 Aug 2026 18:58:50 +0000
Big-int dos not and will not have anything to do with dynamic stack memory.
I’ve played around with the concept of dynamic stack allocations before, I had some applications where that would have been a very cool thing to have for performance reasons.
C “dynamic” arrays are a cool feature, but from an implementation perspective I can also see why C++ has not adopt it as it would be difficult to combine it with other C++ features and how object lifetime works.
Having said that there really isn’t much to talk about unless you also specify what features you would want with this “dynamic array”.
Are we talking about just like C where the array size can only be set once for the entire duration of the function?
Do you want to have dynamic per-scope?
Does dynamic mean can you expand or shrink the array after it has originally been set?
Do you want more than one array which has the dynamic property in the same function?
Do you want it to be sane for inlining?
Depending on what you want you need to have very different implementation considerations, and some combinations are impossible to implement just because of how stacks work.
It has many pitfalls and foot guns.
And the feature is not that easy to use effectively unless you also have features like the ability to consult how much stack you have left, and a way to estimate how much stack you will need to safely call functions.
Otherwise, you haven’t so much created a useful stack allocation feature, as you have created a way to easily make your application blow up the stack.
Have you considered what exactly do you mean by “dynamic”? and what things you would want to be able to do with it?
From: Std-Proposals <std-proposals-bounces_at_[hidden]> On Behalf Of Rune Lund Olesen via Std-Proposals
Sent: Friday, August 21, 2026 13:31
To: std-proposals_at_[hidden]ocpp.org
Cc: Rune Lund Olesen <rune.olesen_at_[hidden]>
Subject: [std-proposals] Dynamic stack based array
Looking at the recent Big-int proposal, this is or could be a case for C++ to provide a dynamically sized array (ie. stack allocated if on the stack).
C has a dynamically allocated array type and it is possible to program something like this by hand in C maybe with MACRO usage inside a function - but it is contained to that function.
Returning dynamically sized objects is not even possible with current calling conventions - but maybe there exists some tricks to get around that (eg. before returning; perhaps rearrange the stack and then move the stackpointer once returned).
Now there would be some type of tracking the size as well and it should be possible to specify staticly how many bytes/bits should be used for that....
Right now the closest there is, is some types of arena put on the stack to start..
What do you think?
I’ve played around with the concept of dynamic stack allocations before, I had some applications where that would have been a very cool thing to have for performance reasons.
C “dynamic” arrays are a cool feature, but from an implementation perspective I can also see why C++ has not adopt it as it would be difficult to combine it with other C++ features and how object lifetime works.
Having said that there really isn’t much to talk about unless you also specify what features you would want with this “dynamic array”.
Are we talking about just like C where the array size can only be set once for the entire duration of the function?
Do you want to have dynamic per-scope?
Does dynamic mean can you expand or shrink the array after it has originally been set?
Do you want more than one array which has the dynamic property in the same function?
Do you want it to be sane for inlining?
Depending on what you want you need to have very different implementation considerations, and some combinations are impossible to implement just because of how stacks work.
It has many pitfalls and foot guns.
And the feature is not that easy to use effectively unless you also have features like the ability to consult how much stack you have left, and a way to estimate how much stack you will need to safely call functions.
Otherwise, you haven’t so much created a useful stack allocation feature, as you have created a way to easily make your application blow up the stack.
Have you considered what exactly do you mean by “dynamic”? and what things you would want to be able to do with it?
From: Std-Proposals <std-proposals-bounces_at_[hidden]> On Behalf Of Rune Lund Olesen via Std-Proposals
Sent: Friday, August 21, 2026 13:31
To: std-proposals_at_[hidden]ocpp.org
Cc: Rune Lund Olesen <rune.olesen_at_[hidden]>
Subject: [std-proposals] Dynamic stack based array
Looking at the recent Big-int proposal, this is or could be a case for C++ to provide a dynamically sized array (ie. stack allocated if on the stack).
C has a dynamically allocated array type and it is possible to program something like this by hand in C maybe with MACRO usage inside a function - but it is contained to that function.
Returning dynamically sized objects is not even possible with current calling conventions - but maybe there exists some tricks to get around that (eg. before returning; perhaps rearrange the stack and then move the stackpointer once returned).
Now there would be some type of tracking the size as well and it should be possible to specify staticly how many bytes/bits should be used for that....
Right now the closest there is, is some types of arena put on the stack to start..
What do you think?
Received on 2026-08-21 18:58:57
