A minimal example of triadic memory, The original C is taken from here with minimal edits done to get it to compile.
To run this, download the 3 files and place them into the same directory. Then use chmod +x test.d
to mark test.d as executable and then you can run it using the rdmd wrapper. If you don't want to use rdmd then just compile it doing something like dmd test.d triadicmemory.c
DMD version v2.109.1
was used on linux, C was compiled via "ImportC" (D's built in C compiler).
- 2025-01-16: I did a direct one to one translation of
triadicmemory.c
to D, I have included it here astriadicmemory_port.d
to use it over the original C implmentation replace line 6import triadicmemory;
withimport triadicmemory_port;
intest.d
.