[Insight-developers] Suggestions with "simple" expression

Bradley Lowekamp blowekamp at mail.nih.gov
Sat May 18 13:09:35 EDT 2013


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


More information about the Insight-developers mailing list