Is this a compiler issue?

Kapendev alexandroskapretsos at gmail.com
Sat Dec 6 21:20:37 UTC 2025


On Saturday, 6 December 2025 at 19:36:01 UTC, DLearner wrote:
> Hi
>
> This uses DMD64 D Compiler v2.111.0, using -betterC, under 
> Windows 10.
>
> With the two commented lines in place, results are as expected.
> Uncomment those two lines, even though the variable is set but 
> never used,
> the program fails at the link stage with reference to a missing 
> '_memsetn'.
>
> Ideas?

I think the problem here is the type `struct[N]` with the betterC 
flag. Try replacing `TestStruct[1] TS1;` with `TestStruct TS1;` 
and `sub1(TS1);` with `sub1((&TS1)[0 .. 1]);`, and things should 
work fine.

If I am right and you want to use a static array of structs 
without defining this function yourself, then you could 
copy-paste [this 
code](https://github.com/Kapendev/joka/blob/main/source/joka/types.d#L61) in your project.


More information about the Digitalmars-d-learn mailing list