This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Static const int as array bound inside class


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]