aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2018-01-18 12:22:27 +0000
committergingerBill <bill@gingerbill.org>2018-01-18 12:22:27 +0000
commitadd53228b2ee93f7374a815ce1c4e5a86b7b9d28 (patch)
treef18cf032c65be941c8f03d9072286810c0bede93 /examples
parentd90008cc524ae7075a91fa763def3918adb61fc6 (diff)
`-no-bounds-check`
Diffstat (limited to 'examples')
-rw-r--r--examples/demo.odin17
1 files changed, 7 insertions, 10 deletions
diff --git a/examples/demo.odin b/examples/demo.odin
index 6461ba5da..617d289eb 100644
--- a/examples/demo.odin
+++ b/examples/demo.odin
@@ -19,6 +19,7 @@ when ODIN_OS == "windows" {
import win32 "core:sys/windows.odin"
}
+@(link_name="general_stuff")
general_stuff :: proc() {
fmt.println("# general_stuff");
{ // `do` for inline statmes rather than block
@@ -367,11 +368,7 @@ parametric_polymorphism :: proc() {
}
copy_slice :: proc(dst, src: []$T) -> int {
- n := min(len(dst), len(src));
- if n > 0 {
- mem.copy(&dst[0], &src[0], n*size_of(T));
- }
- return n;
+ return mem.copy(&dst[0], &src[0], n*size_of(T));
}
double_params :: proc(a: $A, b: $B) -> A {
@@ -662,21 +659,21 @@ named_proc_parameters :: proc() {
b = 567;
return b, a;
}
- fmt.println("foo0 =", foo0());
- fmt.println("foo1 =", foo1());
- fmt.println("foo2 =", foo2());
+ fmt.println("foo0 =", foo0()); // 123
+ fmt.println("foo1 =", foo1()); // 123
+ fmt.println("foo2 =", foo2()); // 567 321
}
main :: proc() {
- when false {
general_stuff();
default_struct_values();
+ when false {
union_type();
parametric_polymorphism();
threading_example();
array_programming();
+ }
using_in();
named_proc_parameters();
- }
}