← Back to team overview

kicad-developers team mailing list archive

Re: Damned the 'undefined global constructor order'

 

On 06/10/2014 04:07 PM, Lorenzo Marcantonio wrote:
> On Tue, Jun 10, 2014 at 02:51:27PM -0500, Dick Hollenbeck wrote:
>> boiled down a bit more, attached.
> 
> Would break for more than 64 layers, so a bitset is not needed in the
> first place...
> 


Lorenzo,

You are on the cusp of failing, and losing this assignment.

I can say that something is important to me, at any time and anywhere.  For you to say
that I cannot, risks your blueprint being rejected.  Plain and simple.  I don't want to
look at function calls for LSET constructors.  You telling me I should has NO effect on
that choice.

Dude, you need to start being easier to work with, NOW.   I just don't have the time or
patience for it any more.  And guess what, I don't have to put up with it.

The 64 bit limit is not HARD, I already said that.  I also said a migration path is an option.

But rather than suggesting an incremental solution, you go off disqualifying everything I
suggested.

If you will please look at the attached, it removes the 64 bit limit.   But that took 10
seconds,  why it takes you arguing about it, I truly don't understand.

64 bits of "fixed purpose, optionally used" layers seems like the best initial path
forward, IMO.  This takes into consideration the affects on the UI, and the existing code.

Aren't there enough fixed purpose layers in 64 possibilities to achieve most any purpose?

If not, then bump up the limit now, define the purpose of each layer in that higher
number, because I am leary of re-purposing layer indices except that the copper stack
needs to be elastic, which is an idea coming from the current code.  I fear we dig too
deep of a hole and mound up too much UI work if we try and re-purpose layers.


Dick


#include <stdio.h>
#include <stdint.h>

//#define __STDC_FORMAT_MACROS

#include <inttypes.h>
#include <vector>


#include <bitset>

enum LAYER_NUM
{
    LAYER_CU_FRONT,
    LAYER_CU_1,
    LAYER_CU_2,
    LAYER_CU_BACK,
};


typedef std::bitset<65> BASE_SET;

class LSET : public BASE_SET
{
public:
    static const LSET   CU_FRONT;
    static const LSET   CU_BACK;
    static const LSET   CU_EXTERNAL;

    LSET() :
        BASE_SET()
    {}

    LSET( const BASE_SET& aOther ) :
        BASE_SET( aOther )
    {
    }
};


//--- above into a header, below into a *.cpp ------------------------


const LSET LSET::CU_FRONT = LSET().set( LAYER_CU_FRONT );
const LSET LSET::CU_BACK  = LSET().set( LAYER_CU_BACK );

const LSET LSET::CU_EXTERNAL = CU_FRONT | CU_BACK;


int main( int argc, char** argv )
{
    // probably endian specific, but for testing is fine.
    printf( "value %08" PRIx64 "\n", *(int64_t*) &LSET::CU_EXTERNAL );

    return 0;
}



References