3 ms·
every time I've looked into this I've found the documentation severely lacking in examples of how one would go about incrementally migrating a c project to bett
by zem 7y ago
every time I've looked into this I've found the documentation severely lacking in examples of how one would go about incrementally migrating a c project to better c. does someone have a pointer to a blog post or even a git commit that illustrates the first step of migrating a single c file, with all the attendant makefile changes?
- WalterBright 7y agoThe dmd backend itself used -betterC to make the conversion from the original C-with-Classes code. DMC++ itself underwent the conversion to D using -betterC. https://github.com/DigitalMars/Compiler/tree/master/dm/src/dmc https://github.com/DigitalMars/Compiler/tree/master/dm/src/d... It still looks a lot like C.
- WalterBright 7y ago1. rename the file from prog.c to prog.d 2. set up to compile with dmc prog.c -c -betterC 3. replace all the preprocessor stuff 4. compile it, and fix the errors diagnosed by the compiler The hardest part will be how much metaprogramming was done using the C preprocessor. Once that's dealt with, the rest is fairly mechanical.