Returning variable-sized stack data

monkyyy crazymonkyyy at gmail.com
Wed Jul 17 13:41:42 UTC 2024


On Wednesday, 17 July 2024 at 09:31:37 UTC, Nick Treleaven wrote:
> On Wednesday, 17 July 2024 at 08:23:45 UTC, IchorDev wrote:
>> On Monday, 15 July 2024 at 17:20:57 UTC, monkyyy wrote:
>>> ```d
>>> int[$] foo(size_t i){
>>>   int[i] output;
>
> Isn't that a stack overflow footgun?

the size_t? probaly; but that ships sailed, slices use size_t 
lengths, its *also* a foot gun that `0-1` sized arrays will very 
much get back a "no" from the os when allocated and crash 
runtime, and theres wildly unnessery bits there.



More information about the dip.ideas mailing list