3 ms·
With Zig, I can just import SDL.h and use it without writing a binding. Can I do that in C3 or Odin?
by AlienRobot 3mo ago
With Zig, I can just import SDL.h and use it without writing a binding.
Can I do that in C3 or Odin?
- flumpcakes 3mo agoOdin has SDL built into the language (shipped as a vendored library).
- AlienRobot 3mo agoThat's not what I mean... There is a mountain of code written in C that you can simply include in Zig without a wrapper dependency and without having to create the wrapper yourself.
- lerno 3mo agoThe Zig C import is going away, moving into a tool invoked from build.zig, so this might not be an ideal thing to point to. C3 just has everything C compatible so not just calling into C but also C calling to C3 is just completely normal with no special compatibility types/functions, unlike Zig. So which one has the most compelling feature kind of boils down to what one focuses on. You can find Odin users that praise Odin for finding their sweet spot. Similarly for C3 users, just like Zig users. And in each of those, they will say that the others didn’t quite match what they wanted (not in all cases though: the relatively high visibility of Zig means a lot of its users is unaware of the languages with less visibility, and just pick it by default)
- pyrolistical 3mo agoAnd then you can get AI do a nicer port of SDL.zig and you get way better decls. Proper enums, proper tagged unions, and often reading the docs can allow the AI to distinguish T * to one of 1. [*]T 2. [:0]T 3. ?T 4. *T And these are just the most common ones. If you know it’s a read only pointer/array then you can add the const modifier