Setting a hard limit on slice size, is this possible?

Tejas notrealemail at gmail.com
Sun Aug 8 02:00:26 UTC 2021


On Saturday, 7 August 2021 at 19:07:04 UTC, Paul Backus wrote:
> On Saturday, 7 August 2021 at 15:41:24 UTC, Tejas wrote:
>> On Saturday, 7 August 2021 at 15:21:01 UTC, Paul Backus wrote:
>>> [...]
>>
>> Oh wow, and here I thought I was being smart :(
>>
>> So, how can we work around this without assembly language 
>> magic? I'm illiterate at assembly.
>
> For stack allocations, you can use the workaround in [Vladimir 
> Panteleev's comment][1]  (ignoring the ASM part, which is 
> unrelated to alignment).
>
> For heap allocations, I guess the easiest way would be to use 
> [`AlignedMallocator`][2] from `std.experimental.allocator`.
>
> [1]: https://issues.dlang.org/show_bug.cgi?id=16098#c3
> [2]: 
> https://phobos.dpldocs.info/std.experimental.allocator.mallocator.AlignedMallocator.html

Cool... thanks


More information about the Digitalmars-d-learn mailing list