Setting a hard limit on slice size, is this possible?
james.p.leblanc
james.p.leblanc at gmail.com
Sun Aug 8 05:33:47 UTC 2021
On Sunday, 8 August 2021 at 02:00:26 UTC, Tejas wrote:
> 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
Thanks to everyone for all of the great discussion and hints on
this topic!
I have learned quite much, and have a gained an understanding on
how to use D effectively.
Fantastic forum here on a great language.
Best Regards,
James
More information about the Digitalmars-d-learn
mailing list