I did put a patch on gerrit: http://review.source.kitware.com/#/c/11312/
but your '\xFF' might work. On Sun, May 19, 2013 at 10:11 AM, Bradley Lowekamp <[email protected]>wrote: > I was thinking about trying '\xFF'. I'll try on my rh6 system to see if > either of these options stop the warning. > > > > On May 19, 2013, at 8:31 AM, Bill Lorensen <[email protected]> > wrote: > > That did not work either. My bad. > > Should it not be > const unsigned char buffer[3] = { 255, 255, 254}; > or > const char buffer[3] = { -1, -1, -2}; > > > On Sat, May 18, 2013 at 3:11 PM, Bill Lorensen <[email protected]>wrote: > >> Try int's. See: >> http://www.stroustrup.com/C++11FAQ.html#narrowing >> >> const char buffer[3] = { 255, 255, 254}; >> >> >> >> On Sat, May 18, 2013 at 1:09 PM, Bradley Lowekamp <[email protected] >> > wrote: >> >>> Hello, >>> >>> I pushed some code yesterday and it's causing a couple problem. It seems >>> simple enough. Whats the best way to express this? >>> >>> // MAGIC_NUMBER = 16777214 ( little endian ) >>> const char buffer[3] = { 0xFF, 0xFF, 0xFE}; >>> >>> >>> ERROR: >>> /Users/builder/external/ITK/Modules/IO/Mesh/src/itkFreeSurferBinaryMeshIO.cxx:311:31: >>> error: constant expression evaluates to 255 which cannot be narrowed to >>> type 'char' [-Wc++11-narrowing] >>> const char buffer[3] = { 0xFF, 0xFF, 0xFE}; >>> ^~~~ >>> /Users/builder/external/ITK/Modules/IO/Mesh/src/itkFreeSurferBinaryMeshIO.cxx:311:31: >>> note: override this message by inserting an explicit cast >>> const char buffer[3] = { 0xFF, 0xFF, 0xFE}; >>> ^~~~ >>> static_cast<char>( ) >>> >>> >>> WARNING: >>> >>> var/lib/jenkins/jobs/ITK-v4-Testing-32-chroot/workspace/MyTests/ITK/Modules/IO/Mesh/src/itkFreeSurferBinaryMeshIO.cxx: >>> In member function 'virtual void >>> itk::FreeSurferBinaryMeshIO::WriteMeshInformation()': >>> /var/lib/jenkins/jobs/ITK-v4-Testing-32-chroot/workspace/MyTests/ITK/Modules/IO/Mesh/src/itkFreeSurferBinaryMeshIO.cxx:311:47: >>> warning: narrowing conversion of '255' from 'int' to 'const char' inside { >>> } is ill-formed in C++11 [-Wnarrowing] >>> >>> >>> Thanks for your suggestion. >>> >>> Brad >>> _______________________________________________ >>> Powered by www.kitware.com >>> >>> Visit other Kitware open-source projects at >>> http://www.kitware.com/opensource/opensource.html >>> >>> Kitware offers ITK Training Courses, for more information visit: >>> http://kitware.com/products/protraining.php >>> >>> Please keep messages on-topic and check the ITK FAQ at: >>> http://www.itk.org/Wiki/ITK_FAQ >>> >>> Follow this link to subscribe/unsubscribe: >>> http://www.itk.org/mailman/listinfo/insight-developers >>> >> >> >> >> -- >> Unpaid intern in BillsBasement at noware dot com >> > > > > -- > Unpaid intern in BillsBasement at noware dot com > > -- Unpaid intern in BillsBasement at noware dot com
_______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Kitware offers ITK Training Courses, for more information visit: http://kitware.com/products/protraining.php Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ Follow this link to subscribe/unsubscribe: http://www.itk.org/mailman/listinfo/insight-developers
