Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Demonstration of allocator references
- fn malloc(size usize) *uni i8;
- fn free(ptr *u8);
- alloc lex {
- fn allocate(size usize) *lex {
- malloc(size) as *lex;
- }
- fn dealias(self *lex) {
- free(self as *u8);
- }
- }
- fn main() {
- imm reffloat = &lex 3.4d;
- *reffloat = *reffloat + 2.0d;
- printANumber(reffloat);
- }
- fn print(str &u8);
- fn printFloat(n f64);
- fn printANumber(nbr &f64) {
- print("The number is: ");
- printFloat(*nbr);
- print("\n");
- }
Add Comment
Please, Sign In to add comment