Topic: Initializer question


Author: rfg@netcom.com (Ronald F. Guilmette)
Date: Sun, 3 Oct 1993 11:42:05 GMT
Raw View
In article <CE10v1.1zJ@world.std.com> nectar@world.std.com (Nectar Nirvana) writes:
>On 09-27-93  15:24, rmartin@rcmcon.com wrote:
>
> > nectar@world.std.com (Nectar Nirvana) writes:
>
> >>--- header.h
> >>class Foo {
> >>public:
> >>        static const int initializer;
> >>};
> >>--- end header.h
>
> >>--- module1.cxx
> >>#include "header.h"
> >>const int Foo::initializer = 16;
> >>--- end module1.cxx
>
> >>--- module2.cxx
> >>#include "header.h"
> >>char array[Foo::initializer];
> >>--- end module2.cxx
>
> >>GNU G++ compiles this, but IBM XLC++ bombs on module2.cxx with a message
> >>saying that Foo::initializer must be a positive constant expression.
>
>
> > In order for a 'const int' to be used to declare the dimension of the
> > array, the definition for that constant must be known by the compiler
> > prior to the array declaration.
>
>        This sounds well and good, but where is it pointed out in the
>        ARM?

I happen to think that's a very good question.

(Follow-ups to comp.std.c++ please.)

--

-- Ronald F. Guilmette ------------------------------------------------------
------ domain address: rfg@netcom.com ---------------------------------------
------ uucp address: ...!uunet!netcom.com!rfg -------------------------------