On Thursday, 2 June 2022 at 19:40:49 UTC, Jack Stouffer wrote:
>It's currently practically impossible to translate existing D code to use BetterC in a large code base (haven't tried existing C code, I imagine it's easier). I have an existing app which is ~100,000 lines of D code and I've tried and failed to convert it to BetterC with my own custom runtime.
I have also used -betterC
to some extent. Unfortunately I have to agree that you're mostly right.
IMO -betterC
works somewhat well when you don't use Phobos much. But if you're using it to any significant extent it's far from working out of the box. I learned that one should copypaste and adapt stuff from Phobos and DRuntime when they don't work right away. -i
to the standard library or -allinst
might also help, have not tried them myself.
In principle all the ranges stuff that does not use the GC should work seamlessly with -betterC
In practice the problem is that some of the -betterC
features are implemented by simply not linking the Phobos binary in. Result is that the Phobos source files are processed as header files, but without anything to link to if anything precompilable is found in the files. It might be most practical to simply use the compiler switch to link the Phobos binary in with -betterC
. On the other hand, I don't know how much this defeats the purpose of using -betterC
in the first place.