Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!agate!saturn!saturn.ucsc.edu!daniel From: daniel@saturn.ucsc.edu (Daniel Edelson) Newsgroups: comp.lang.c++ Subject: unbounded static array member Message-ID: <11024@saturn.ucsc.edu> Date: 8 Mar 90 21:49:20 GMT Sender: daniel@saturn.ucsc.edu Reply-To: daniel@saturn.ucsc.edu (Daniel Edelson) Organization: University of California, Santa Cruz; CIS/CE Lines: 41 Is there or should there be a syntax for declaring a static array member whose length is determined by the length of its initializer list? e.g., struct S static int array[]; // Error, bound required }; int S::array[] = { 1, 2, 3, 0}; It would also be OK if the array variable were of pointer type, e.g., struct S { static int * array; }; int S::array[] = { 1, 2, 3, 0}; // Error, type mismatch int * and int [] struct S { static int * array; }; int * S::array = { 1, 2, 3, 0}; // Error, initializer list too long The only way around this that I've found requires an extra variable. struct S { static int * array; }; int table[] = {1, 2, 3}; int * S::array = table; But it would be preferable to avoid the extra variable. daniel@cis.ucsc.edu