Ed_
40ffed9538
I now generate the layout the compiler wants, eventually I'll just have a custom policy so that the compiler can accept the non-idiomatic layout See scripts/build.ps1 & gen_staged_compiler_codebase.ps1 for how this is handled.
31 lines
320 B
Odin
31 lines
320 B
Odin
package sectr
|
|
|
|
// Provides an alternative syntax for pointers
|
|
|
|
Ptr :: struct( $ Type : typeid ) {
|
|
v : Type,
|
|
}
|
|
|
|
exmaple_ptr :: proc()
|
|
{
|
|
a, b : int
|
|
var : ^Ptr(int)
|
|
reg : ^int
|
|
|
|
a = 1
|
|
b = 1
|
|
|
|
var = &{a}
|
|
var.v = 2
|
|
var = &{b}
|
|
var.v = 3
|
|
|
|
a = 1
|
|
b = 1
|
|
|
|
reg = (& a)
|
|
(reg^) = 2
|
|
reg = (& b)
|
|
(reg^) = 3
|
|
}
|