On Saturday, 11 December 2021 at 08:05:01 UTC, Ola Fosheim Grøstad wrote:

Using libraries can trigger hidden allocations.

ok. fine. no unnecessary, hidden allocations then.

// ------------------

module test;

import core.stdc.stdio : putchar;

nothrow @nogc void main()
{
    string str = "abc;def;ab";

    ulong len = str.length;

    for (ulong i = 0; i < len; i++)
    {
        if (cast(int) str[i] != ';')
            putchar(cast(int) str[i]);
    }
}

// ------------------

Reply via email to