Re: Static constant class members

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

 



On Saturday 28 February 2004 22:13, Eljay Love-Jensen wrote:
> You cannot initialize static data members in-class.  (You can in Java, not
> in C++.)
This construction works fine in gcc 3.3

 class TxtVideo {
    protected:
      static const int test = 10;

>
> You need to do this:
>
> --- TxtVideo.h ---
> class TxtVideo {
>    protected:
> 	static unsigned int* const VBASE;
>
> --- TxtVideo.cpp ---
> unsigned int* const TxtVideo::VBASE = (unsigned int*) 0x0c00b8000L;
This is true, but actual value of the constant wouldn't be avaible in files 
which includes "TxtVideo.h", so compiler wouldn't insert it as imidiate 
operand, instead it will insert memory reference. Im I wrong ?

> HTH,
> --Eljahy

[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