-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Closed
Milestone
Description
Hello,
Using gcc 6.1.0.
Compilation error (-Wconversion -Werror):
./deps/json.hpp:9995:25: required from here
./deps/json.hpp:5957:72: error: conversion to 'char' from 'int' may alter its value [-Werror=conversion]
: ('a' + static_cast<char>((v - 10) & 0x1f));
^
./deps/json.hpp:5957:72: error: conversion to 'char' from 'int' may alter its value [-Werror=conversion]
const auto hexify = [](const int v) -> char
{
return (v < 10)
? ('0' + static_cast<char>(v))
: ('a' + static_cast<char>((v - 10) & 0x1f));
};Could be written as something like:
const auto hexify = [](const int v) -> char
{
static const std::array<char, 16> hex = { '0', '1', '2', '3',
'4', '5', '6', '7',
'8', '9', 'a', 'b',
'c', 'd', 'e', 'f' };
return hex[v];
};Would you be interested in a PR for such a change?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels