#!/usr/local/bin/rune -x # # Demonstrate return defaulting limport "sys"; import "stdio"; int main(int ac, char **av) { int x; (int h, int hh) y; x = fubar1(10); stdio.stdout->show(" x should be 4:", x); x = fubar2(10); stdio.stdout->show(" x should be 15:", x); x = fubar3(20); stdio.stdout->show(" x should be 43:", x); y = fubar4(30); stdio.stdout->show(" y.hh should be 18:", y.hh); y = fubar5(30); stdio.stdout->show(" y.hh should be 36:", y.hh); y = fubar6(30); stdio.stdout->show(" y.h should be 44:", y.h); stdio.stdout->show(" y.hh should be 46:", y.hh); return(0); } typedef int myint_t = 4; myint_t fubar1(int x, myint_t z) { z = z + 1; stdio.stdout->show(" z should be 5:", z); return; } myint_t fubar2(int x, myint_t z) { z = z + 1; stdio.stdout->show(" z should be 5:", z); return (x + z); } int fubar3(int x) { $ = x + 23; return; } (int g, int gg = 18) fubar4(int x) { return; } #typedef (int g = 4, int gg = g + 2) mycomp_t; (int g = 4, int gg = g + 2) fubar5(int x) { stdio.stdout->show("fubar5 default 4:", $.g); stdio.stdout->show("fubar5 default 6:", $.gg); $.gg = $.gg + x; return; } (int g = 4, int gg = g + 2) fubar6(int x) { $.gg = $.gg + x; return 44; }