Would "a & 255" give the same error, or is it just "a % 256" ?
(I know, I could try myself; a bit lazy ;-)
 
-- Peter.


Från: Gehua Yang <yanggehua@gmail.com>
Till: vxl-maintainers@lists.sourceforge.net
Skickat: måndag, 3 oktober 2011 1:40
Ämne: [Vxl-maintainers] VXL compilation issue with GCC v4.4.5 (Fedora 13) and flag "std=c++0x"

Hi folks,

I wonder if anyone has successfully compiled VXL with GCC and flag
"std=c++0x".  On my Fedora 13 box, the compilation resulted in the errors
reported (attached at the end  of email).  Basically,  it affects the code
like this:

    int a, b;
    unsigned char  c=a;  // no error
    unsigned char d[] = {a, b};  // same error as below.

Once fix is to use explicit cast inside {}.  But I am not sure if this is
the intended behavior of C++'0x standard or it is just for some versions of
GCC.  Any ideas or comments?

Best regards,
Gehua Yang




/home/builds/vxl/src/core/vil1/tests/test_save_load_image.cxx: In function
'vil1_image CreateTest24bitImage(int, int)':
/home/builds/vxl/src/core/vil1/tests/test_save_load_image.cxx:401: error:
narrowing conversion of '(x % 256)' from 'int' to 'unsigned char' inside { }
/home/builds/vxl/src/core/vil1/tests/test_save_load_image.cxx:401: error:
narrowing conversion of '((((x - (wd / 2)) * (y - (ht / 2))) / 16) % 256)'
from 'int' to 'unsigned char' inside { }
/home/builds/vxl/src/core/vil1/tests/test_save_load_image.cxx:401: error:
narrowing conversion of '((y / 3) % 256)' from 'int' to 'unsigned char'
inside { }
/home/builds/vxl/src/core/vil1/tests/test_save_load_image.cxx: In function
'vil1_image CreateTest3planeImage(int, int)':
/home/builds/vxl/src/core/vil1/tests/test_save_load_image.cxx:413: error:
narrowing conversion of '(x % 256)' from 'int' to 'unsigned char' inside { }
/home/builds/vxl/src/core/vil1/tests/test_save_load_image.cxx:413: error:
narrowing conversion of '((((x - (wd / 2)) * (y - (ht / 2))) / 16) % 256)'
from 'int' to 'unsigned char' inside { }
/home/builds/vxl/src/core/vil1/tests/test_save_load_image.cxx:413: error:
narrowing conversion of '((y / 3) % 256)' from 'int' to 'unsigned char'
inside { }
make[2]: ***
[core/vil1/tests/CMakeFiles/vil1_test_all.dir/test_save_load_image.o] Error
1
make[1]: *** [core/vil1/tests/CMakeFiles/vil1_test_all.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....