#in zig vs odin which is more low level

1 messages · Page 1 of 1 (latest)

sharp fractal
#

Except compiletime which is more capable between odin and zig

  1. Means more low level
  2. More performance
reef owl
#

I've never used it but I believe they're pretty much at the same level

#

You can write fast code in both, and you can write slow code in both

#

Try them both out and see which you prefer :)

sharp fractal
#

Am coming from golang.
I tried both
But zig looks like more capable than odin because

  1. Built in funcs like @aligncast, @bitcast, @addrspacecast, @setalignstack

Is These things done with odin or not

reef owl
#

You will be able to do things like this in odin yes, but I'm not sure how they're done as I don't use odin

#

Zig takes a very explicit approach here; it's possible Odin is more relaxed about these types of casts and merges them into more general operations

cerulean slate
#

alignCast isn't necessary in Odin because alignment isn't part of the type there.
You use an intrinsic function to load or store in an unaligned manner.

@as(T, @bitCast(x)) is just transmute(T)x in Odin.

@addrSpaceCast currently doesn't exist in Odin because it doesn't support CPUs that have multiple address spaces.

@setAlignStack isn't really necessary in Odin because it aligns the stack for you based on the target automatically.

#

But yes - Odin can do anything that C can do. It's a low level systems programming language, just like Zig is.

stray jay
#

Imo both are great languages it’s just personal preference which one you use

silk sequoia
#

as a person who primarily uses and prefers zig, Odin is a delightful language to use

dry wolf
#

You, @sharp fractal, have asked this question on the Odin Discord as well, but seem to be confused by a few concepts.

Odin and Zig are just as "low level" as each other and just as "powerful" as each other.

@cerulean slate has done a lovely summary of those things.

Just because Zig may have some other built-in @ functions does not mean that Odin is lacking, rather that Odin doesn't need them or has something else entirely for the same problem those things try to solve.

P.S. if we ever do start supporting platforms with multiple address spaces, then I'll add the equivalent of an address space cast to Odin, but no sooner.