On Tuesday, 16 December 2025 at 20:48:25 UTC, DLearner wrote:
I have a rather complicated string mixin defined and invoked from within the same source file.
Which seems to work.

But when I move the mixin definition to a separate module, and import that module into the original source file, the compilation collapses complaining that array concatenation requires the GC, which is not available with -betterC.

DLearner

My solution to this is something like:

```d
import core.stdc.stdio;

string genStuff(string val)() {
    return val ~ ";\n";
}

extern(C)
void main() {
    printf(genStuff!("Hello").ptr);
}
```

This is **in my opinion** the best way to do things if you use the `betterC` flag.
  • Do string mixins... DLearner via Digitalmars-d-learn
    • Re: Do stri... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
      • Re: Do ... DLearner via Digitalmars-d-learn
        • Re:... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
          • ... DLearner via Digitalmars-d-learn
            • ... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
              • ... DLearner via Digitalmars-d-learn
        • Re:... Adam D. Ruppe via Digitalmars-d-learn
          • ... DLearner via Digitalmars-d-learn
    • Re: Do stri... Kapendev via Digitalmars-d-learn

Reply via email to