This commit is contained in:
Krzosa Karol
2022-09-30 16:47:00 +02:00
parent 0d2a95ab89
commit de7d109f00

View File

@@ -8,7 +8,7 @@ The language is currently **very debuggable**. It can produce readable C code wi
* More examples can be found in /examples and /modules
```
``` odin
#import "KERNEL32.core"
#import "Base.core"
@@ -18,12 +18,6 @@ Memory :: struct
reserve: SizeU
data : *U8
ProcessHeap: HANDLE
Allocate :: (size: U64): *void
if ProcessHeap == 0
ProcessHeap = GetProcessHeap()
return HeapAlloc(ProcessHeap, 0, size)
Reserve :: (size: SizeU): Memory
// C like compound expressions with named arguments
result := Memory{reserve=AlignUp(size, PAGE_SIZE)}
@@ -65,6 +59,7 @@ Release :: (m: *Memory)
## Operator overload example
```
Vec3 :: struct ;; x: F32; y: F32; z: F32
"-" :: (a: Vec3, b: Vec3): Vec3 ;; return {a.x-b.x, a.y-b.y, a.z-b.z}
"-" :: (a: Vec3): Vec3 ;; return {-a.x, -a.y, -a.z }
```