Wednesday, March 05, 2008

class notes for today

type
colors ( red, blue, green, yellow, orage, white, black);

colorset = set of colors;

var
set1, set2 : colorset;

set1 := [ red, blue, yellow ];
set2 := set1;
set2 := [black, blue ];

if (ch = 'c' or ch = 'r' or ch = 'y')

if (ch in ['c', 'r', 'y'])

if (c in colorset)

as bitset

['a' ... 'p']

foo()
{
int * p, *y;
p = &f;
p = y;

cout *p;

cout p;
p = y;
*p = *y;
p =: y;
p =: f;


int * p = new int [100];

p = new int [100];

*(p + 7);
p[7];
cout 7[p];
*(7 + p);

int &r = t;

r
*r

}


Tombstone
lock and key

int *y;
foo()
{
Int *p;
p = new int;
y = p;
}

eager approach
lazy approach

refernce counting
garbage collection

No comments: