Small @nogc experience report
Meta
jared771 at gmail.com
Fri Sep 7 20:38:26 UTC 2018
On Friday, 7 September 2018 at 17:35:12 UTC, Eugene Wissner wrote:
> On Friday, 7 September 2018 at 17:01:09 UTC, Meta wrote:
>> Semi-unrelated, but I think you should open a bug for this
>> one. I remember Andrei stating before that every function in
>> std.algorithm except for LevehnsteinDistance(?) is @nogc, so
>> he either missed topNCopy or the gc-ness of the function has
>> changed sometime between ~2015 and now.
>
> It was never true. Here is another example:
>
> import std.algorithm;
>
> void main() @nogc
> {
> int[4] a, b;
>
> fill(a[], b[]);
> }
>
> The funny thing is that fill() doesn't always allocate, but
> only if the element to fill with, is an array. fill() uses
> enforce() which allocates and throws. Other algorithms (e.g.
> equal) have special handling for character arrays and throw if
> they get wrong unicode or use some auto-decoding functions that
> aren't @nogc.
I'm sure I've heard Andrei mention it multiple times, but I must
be misremembering something.
More information about the Digitalmars-d
mailing list