Re: Reasonable static initialization assurance

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

 



Yea, I figured as much.  

Current solution uses a character array for the global variable and a
static accssor that assigns that to a static const std::string.

I knew there was no way around that -- but I thought there might be
some way to do it, in some order.

Eljay,

  Do you know of any difference in this area with the OSX gcc?

corey

On 9/19/05, John Love-Jensen <eljay@xxxxxxxxx> wrote:
> Hi Corey,
> 
> > Is there any way to ensure a static variable in file.b is initialized before
> being used?
> 
> Yes, but you'll have to refactor your code a bit.
> 
> Use a static function in FileB to return FileB's static data (which is
> static data inside that static function).
> 
> Have FileA get to the FileB's static data through that accessor function.
> 
> HTH,
> --Eljay
> 
>


[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