harec

[hare] Hare compiler, written in C11 for POSIX OSs
Log | Files | Refs | README | LICENSE

29-unarithm.ha (375B)


      1 type abool = bool;
      2 
      3 fn lnot() void = {
      4 	assert((!*(&2: *bool))==false);
      5 	assert(!(false: abool));
      6 };
      7 
      8 fn addr() void = {
      9 	let x = 42;
     10 	let xptr = &x;
     11 	assert(*xptr == 42);
     12 	let y = &69;
     13 	assert(*y == 69);
     14 	let z = &struct { a: int = 42 };
     15 	assert(z.a == 42);
     16 	let a = -2;
     17 	assert(a == 0 - 2);
     18 	let b = 1-1;
     19 	assert(b == 0);
     20 };
     21 
     22 export fn main() void = {
     23 	lnot();
     24 	addr();
     25 };