Re: openCOLLADA: Help with GCC6 narrowing conversion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 16/02/16 10:51 +0000, Jonathan Wakely wrote:
Given that there are dozens of those initializers it might be more
readable to do:

static const char none = -1;
const char HEX2DEC[256] = { none, none, none, ..... }

For the avoidance of doubt, this is not an error in C++11.

Narrowing conversions are only erorrs when they appear inside a
braced-init-list. So 'none' is initialized to (char)-1 without error,
then the elements of the HEX2DEC array are initialized from char
values that need no conversion, so also without error.

The original code required -1 to be converted to char inside the
braqced-init-list for HEX2DEC.
--
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxxx
http://lists.fedoraproject.org/admin/lists/devel@xxxxxxxxxxxxxxxxxxxxxxx




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux