[Nickle]Mystic shallow copy semantics solved

Keith Packard keithp@keithp.com
Mon, 19 Feb 2001 21:16:30 -0800


Try:

	a = [3]{1,2,3};
	b = a;
	b[0] = 2;
	a

Now try:

	array a = [3]{1,2,3};
	array b = a;
	b[0] = 2;
	a

When 'b' is undeclared, the assignment 'b = a' makes a shallow copy of 'a',
when 'b' is declared as an array, the copy is deep.

Oops.

keithp@keithp.com	 XFree86 Core Team		SuSE, Inc.