I am used to explicitly invoking the default constructor to initialize values to ‘zero’, but that does not seem to work with GIL.

 

In the following code:

 

template<class View>

void do_something(View const& img){

            typedef typename View::value_type pixel_type;

 

            pixel_type black = pixel_type();

            //I expect zero, I guess this may not always be black…

 

            //…..

}

 

 

The value held in ‘black’ turns out to be 205 (I think it is acting like uninitialized stack data).

 

Is this the intended behavior?  I have a slew of code that used to work this way and somehow now it does not – did this behavior change recently?

 

In the meantime I just made a struct named black with a typecast operator enabled for gil pixels.

 

-- John