Re: How do I create/initialize a large class static (const?) array?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Lee Rhodes wrote:

> I need to create a class static (const?) array and then initialize it once
> when the first instance of the class is declared after which it should never
> be modified, only read.  This array is too large to use the array {...}
> initializer syntax.  I need to initialize the array with an algorithm.
> 
> The following obviously does not work, but I'm not sure how to do it. (It is
> very easy in Java!)

This is a C++ language issue and not a gcc issue.  A good book on C++
should explain why the code fails -- static data members must be defined
in exactly one unit.  This page (and the rest of the site) is a good
resource: http://www.parashift.com/c++-faq-lite/ctors.html>.  It
describes several ways of solving the problem you describe.

Brian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux