← Back to team overview

kicad-developers team mailing list archive

Re: Damned the 'undefined global constructor order'

 

On Wed, Jun 11, 2014 at 02:19:18AM +0300, Povilas Kanapickas wrote:
> A common solution to this problem is to never use global static
> variables. Instead, create a function that contains a local static
> variable of wanted type and returns a reference to it. The variable will
> be constructed on the first invocation of the function. In this way all
> invocations of such global "constructor functions" will be serialized as
> the dependencies become explicit.

Exactly what I done at last, thanks for the suggestion.

static const O &consfun()
{
    static const O r = initialize_value;
    return r;
}

Please explain it to Dick, if you can.

I was trying to fix the issue once for all in the best way possible and
he doesn't accept the solution for no technical reason whatsoever.

People wants more than 64 layer and still propose something based on
a 64 bit integer during construction.

Applied his suggestion for names and low-numbered layer initialization
and no, still it's no good. Because it has function calls (as you said
it's the standard way to do it) and he only wants MACROS (in C++, please
note) and global variables.

As the migration path I don't see the issue, the whole system already
compiles and seems to work, it just needs testing.

I think that if he only wants contract programmers for implementing the
thing only exactly as he wants, he's looking in the wrong place.

Since I have my code branch anyway if you want the code it will be
there.

-- 
Lorenzo Marcantonio
Logos Srl


References