Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If your platform is supported by LLVM, Zig is worth serious consideration. It is able to target any of the operating systems you mention, from any of the operating systems you mention. Linking to the syscall interface / libc / C libraries is straightforward, exporting functions which respect the local ABI is quite simple.


The Linux kernel only compiles with GCC the last I heard though. Also the libc is probably different, so I suspect it'd be trickier than expected.



For drivers? I suppose if it has really good C interop that might work... is that a thing?


https://ziglang.org/documentation/master/#C

Zig has near-seamless C interop and the Zig compiler is also C cross-compiler:

https://zig.news/kristoff/cross-compile-a-c-c-project-with-z...


Yes, Zig has excellent C interop.


Latest release of zig is 0.13. I guess it’s fine for hobby projects and learning…


It's true that, as a pre-1.0 language, choosing Zig means taking on the implementation burden of changing code to keep up with language changes. But it's already being used in production in a surprising number of places.

Wanting to wait until 1.0 to get started is a respectable choice. I prefer to get a head start, compile against master every few weeks, and change what needs changing.


At some point it becomes a bit ridiculous to be pre 1.0 for nearly a decade. It is symptomatic of a level of complexity and confusion about the core language use cases* that is a nonstarter for me.

* In other words, I think it's trying to do way too much and would have benefitted from aggressive scope reduction years ago.


Avoiding C's biggest issues can overcome a good amount of pre-1.0 problems.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: