s |
focus search bar ( enter to select, ▲ / ▼ to change selection) |
g e |
go to examples |
g m |
go to modules |
g o |
go to overview |
g r |
go to reference |
h |
toggle this help ( esc also exits) |
*
Use
*
for value,^
for address1 2,!
for ownership
Jai does not use&
for references;using
can provide that functionality 3
// from: https://youtu.be/-UPFH0eWHEI?t=769
N :: 10;
Entity :: struct {
serial_number : int;
}
value : Entity; // type declared as Entity
values : [N] float; // type declared as N-long array of floats
pointer : ^Entity; // type declared as address of an Entity
pointer = ^value; // assignment as address of Entity named 'value'
pointers : [N] ^Entity // type declared as N-long array of addresses of Entities
pointer := ^value; // get a pointer to a value's memory address
value := *pointer; // get a value by dereferencing a pointer
for pointers, use Pascal-style pointy hat (^
) instead of ampersand (&
). still use star (*
) to dereference a pointer.
“Demo: Iteration and arrays, uninitialized values, enums.” YouTube, uploaded by Jonathan Blow, Dec 10, 2014, https://youtu.be/-UPFH0eWHEI?t=769 ⮌
star (*
) brings us toward the value, and hat (^
) brings us away from the value.
“Demo: Iteration and arrays, uninitialized values, enums.” YouTube, uploaded by Jonathan Blow, Dec 10, 2014, https://youtu.be/-UPFH0eWHEI?t=821 ⮌
references in C++ are just pointers with a different syntax and different defaults, so I would rather have a way to have one thing.
“Q&A after Data-Oriented Demo.” YouTube, uploaded by Jonathan Blow, Jan 21, 2015, https://youtu.be/HjyyREM0egw?t=840 ⮌
jailang
2019 pixeldroid
https://github.com/pixeldroid/jailang |
programming pages theme v0.5.21 (https://github.com/pixeldroid/programming-pages) |
s |
focus search bar ( enter to select, ▲ / ▼ to change selection) |
g e |
go to examples |
g m |
go to modules |
g o |
go to overview |
g r |
go to reference |
h |
toggle this help ( esc also exits) |