Comparing Zig with Odin

Is there a recommended and unbiased source of information which provides a dependable comparison between Zig and Odin?

Seems that most I have come across are long-winded and hard to distinguish the differing features, pros and cons, when to use Zig versus Odin, available tooling, cross-platform, etc.

As far as I can tell, Odin is more suited to my needs as a game developer, but I could be wrong.

2 Likes

Just try them both and see what sticks. Here are a few of my opinions. I wrote a lot of Zig and am getting into Odin.

  • Zig is very verbose which is good in itself, but it’s up to the point where I find it harder to write and read sometimes. Odin in comparison is very minimal in terms of typing while communicating basically the same info.
  • Zig let’s you go nuts with meta programming. I don’t think most people need this, but it’s definitely a cool feature.
  • Odin has this awesome built-in array programming which should come in handy for any games developer! I’m not sure if Zig’s Vectors can hold up.
  • Zig works without any additional tools on all my systems and does cross compilation between them. No Visual Studio or separate clang required.
2 Likes

Zig’s @Vector(N, T) is closer to Odin’s #simd[N]T, and not just Odin’s array programming on normal fixed-length arrays. This means the alignment requires are different.

1 Like

I would suggest trying out both and see which one you like better. I think Zig emphasizes more on the ‘correctness’ aspect of the code while Odin tries to get out of the way as much as possible.

There’s also differences like Zig requiring explicit allocators (much like C++) while Odin’s allocators are tucked away in the implicit context which is lovely for composability.

I do like Zig’s ability to import C header files directly - but I’ve read that it comes with its own set of issues and edge cases making it not so useful in practice.

Also, Odin feels mostly done from a language standpoint while Zig is still making big breakable changes every release (something to be aware if you want to start a new project).

I’m a long time Zig user since version 0.11.0 (maybe even older), and recently I got interested in Odin. Here’s several big differences between Zig and Odin from my POV:

  1. Syntax of Zig is more minimal, which can be good or bad depending on how you look at it. From my experience, more simple syntax force you to dig deeper into hardware/algorithm and codes are generally more compact, however, it is sometimes harder to express high level concepts.
  2. Odin is more batteries-included. I think >90% libraries needed by game development or simillar tools are already in core/vendor packages. There’re some good library bindings for Zig of course, but they’re more community or personal efforts, which might lose maintainance because of losing-interests or burnout.
  3. Cross-compiling is being taken very seriously by Zig developers, which directly influenced many aspect of the language (such as type system, build system, standard library, tooling etc).
  4. Both standard library and syntax of Zig is still changing, not very drastically though (but you never know). Odin is more stable, which I think is mainly due to the fact it’s already being extensively used in commercial products, in which @gingerBill plays important role.
4 Likes