Changed codebase to be foldered (breaking compiler's conventions)
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.
This commit is contained in:
30
code/grime/ptr.odin
Normal file
30
code/grime/ptr.odin
Normal file
@ -0,0 +1,30 @@
|
||||
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
|
||||
}
|
Reference in New Issue
Block a user