view examples/c3/types.c3 @ 367:577ed7fb3fe4

Try to make thumb work again
author Windel Bouwman
date Fri, 21 Mar 2014 10:27:57 +0100
parents 158068af716c
children
line wrap: on
line source


/*
 Demo of how to define types
*/

module typedemo;

type int A;
type int B;
type struct {
  int x, y;
  A z;
} C;
type struct {
  C x;
  B y;
  int z;
} D;

type D* E;

function int testcast()
{
    var A a;
    var B b;
    a = 3;
    b = a;
    var C c;
    c.x = a;
    c.z = c.y;
    var D d;
    var E e;
    var D* e2;
    e = &d;
    e2 = e;
    e2->x.x = 22;
    
    return 0;
}