Zig cc: A drop-in replacement for GCC/Clang (2020) (andrewkelley.me)
recommended by 1 user | 2021 | 301 points by AlexeyBrin | c and c++ | original thread |
One user recommended this thread. What they said:
gavinray Sep 8, 2021 | on: Maintain It with Zig | context

Me too.

> To me it's the clear choice if I'm going to rewrite an old C project since I can mostly just copy paste the old code and it runs

With the new ImportC feature you can literally copy-paste the code and reference your C types from D directly with a mixed compilation.

https://news.ycombinator.com/item?id=27872596

https://dlang.org/spec/importc.html

Quoting Walter from the thread linked above on it's purpose/reasons (which I think ought to go somewhere official tbh, since that brief discussion in the above thread is the best + most succinct overview of it currently AFAIK)

  The reasons for ImportC are:

  1. It's no longer necessary to translate .h files to D to interface with C. While doing the translations isn't hard, it is tedious, and if there are a lot of .h files it becomes a barrier.

  2. .h files get updated over time, and correspondingly updating the D files is error prone. It's much more effective to just compile the new .h files.

  3. It is not necessary to even create a .h file - just compile the .c file with ImportC and D will access it just like any other module. D will even inline the C functions in it.

  4. Use it as a standalone, small and fast, C compiler.