Skip to content

Commit 9e744a4

Browse files
committed
fix and references
1 parent 5fce974 commit 9e744a4

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

content/posts/odin-guide.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ This means functions are values and can be assigned like any other value.
4141
All types like `int` and `float` are of type `typeid`.
4242

4343
```odin
44-
a :: = int; // a is int
44+
a :: int; // a is int
4545
b: a = 1; // b is now an int
4646
```
4747

@@ -136,6 +136,14 @@ foo = x when condition else y // compile time ternary
136136

137137
## References
138138

139+
In odin there are no references like in C++ and no reference types like in C#, Odin is similar to C in that you need a pointer to reference variables.
140+
141+
When passing a value as an argument, it passes as a pointer if automatically if its more effecient
142+
this is enabled by the fact that all parameters are immutable in Odin, making it feel like everything is always copied like in c.
143+
Passing a pointer value makes a copy of the pointer, not the data it points to.
144+
slices, dynamic arrays, and maps have no special considerations here,
145+
they are normal structs with pointer fields, and are passed as such, in that regard they work like reference types.
146+
139147
## Memory
140148

141149
## Pointers

0 commit comments

Comments
 (0)