[Insight-developers] Suggestions with "simple" expression

Bill Lorensen bill.lorensen at gmail.com
Sun May 19 08:31:25 EDT 2013


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 <bill.lorensen at gmail.com>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 <blowekamp at mail.nih.gov>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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-developers/attachments/20130519/a65592f7/attachment.htm>


More information about the Insight-developers mailing list