Static const int as array bound inside class
Andrew Pinski
pinskia@gmail.com
Fri Jun 29 00:43:00 GMT 2007
On 6/27/07, Torquil Macdonald Sørensen <torquil@gmail.com> wrote:
>
> Best regards,
> Torquil Sørensen
>
> /////////
> Example code (from the book):
>
> class X {
> static const int size;
> int array[size];
> };
>
> const int X::size = 100;
>
> It gives the error message "array bound is not an integer constant"
That is the correct error message. You want:
class X {
static const int size = 100;
int array[size];
};
const int X::size;
Thanks,
Andrew Pinski
More information about the Gcc
mailing list