#!/usr/local/bin/rune -x # # Demonstrate typedef import "sys"; import ; alias stdio.File @stdout = stdio.stdout; class Fubar { int a = 1; int b = 2; alias int c = a + b + 40 + b + a * 2 + a; alias int d = c + c; } int main(int ac, string_p *av) { Fubar f; Fubar *g; alias int x = f.d + f.d; int y; g.new(); stdout->show("Size should be 8:", sizeof(Fubar)); stdout->show("Size should be 8:", sizeof(*g)); y = x; stdout->show("y should be 192:", y); f.a = 3; stdout->show("x should be 224:", x); y = f.d; stdout->show("y should be 112:", y); y = f.d + f.c; stdout->show("y should be 168:", y); f.a = 1; stdout->show("Should be 1:", f.a); stdout->show("Should be 2:", f.b); stdout->show("Should be 48:", f.c); stdout->show("Should be 96:", f.d); stdout->show("Should be 192:", x); stdout->show("Should be 1:", g->a); stdout->show("Should be 2:", g->b); stdout->show("Should be 48:", g->c); stdout->show("Should be 96:", g->d); }