[Nickle] Growable arrays, sort of

Keith Packard keithp at keithp.com
Sun Jun 29 16:14:01 PDT 2003


Around 14 o'clock on Jun 29, Barton C Massey wrote:

> Were int[*] and int[] supposed to be synonyms?  I had
> thought not: one of them should allocate a zero-length
> growable array?

int[*] is a one-dimensional array of indeterminant length.
int[] is an array of indeterminant dimensions, each of indeterminant 
length:

	> int[] a = (int[1,2]) { };

works, while

	> int[*] b = (int[1,2]) { };
	->     int[*] b = (int[1, 2]) {};
	<stdin>:8: Incompatible types, storage 'int[*]', value 'int[1, 2]', for initializer

> Need dim() to return the right thing.  An alternate name for
> the actual size would be fine...

Yeah, but that requires additional work....

-keith





More information about the Nickle mailing list