You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I was reading the Odin language overview and I found the above a bit confusing. A few reasons:
The way I understand this, if you pass arguments by value to a function, you are making a copy. It's when you use a pointer like in C that you do not copy. So why do the docs say that you need to generate a copy to have the "pointer behavior" (so to speak)?
If what it's meant is that Odin first makes a copy of the argument, and then you have to copy back the original thing that was passed, how is that done by a line like x := x?
Does this imply some computational penalty because we are making copies?
Since I don't really understand how this works I can't say how this should be rephrased (if at all) but I thought it might be helpful to give some feedback on this.
The text was updated successfully, but these errors were encountered:
It's not really "pointer behavior" it's just that x := x wouldn't bee necessary in C. It's more meant to show that you can't mutate the passed parameter, unless it contains pointers like the slice, etc mentioned
You already get copies, it's just that you can't mutate them
As stated in the docs above the highlighted code, it should be good for optimizations
https://github.com/odin-lang/odin-lang.org/blob/56ba2d01a1ea53a02b934b70733e9fb04ce8a864/content/docs/overview.md?plain=1#L670C1-L680C4
Hi, I was reading the Odin language overview and I found the above a bit confusing. A few reasons:
x := x
?Since I don't really understand how this works I can't say how this should be rephrased (if at all) but I thought it might be helpful to give some feedback on this.
The text was updated successfully, but these errors were encountered: