aboutsummaryrefslogtreecommitdiff
path: root/src/qt/receivecoinsdialog.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2019-07-30 16:58:16 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2019-07-30 16:58:24 +0200
commit74f1a27f2f45af7dafcc34df766cf76d29c7c6ed (patch)
treedc2bf76bf5350aa9c3de9b0eeb4fc24f53157d85 /src/qt/receivecoinsdialog.cpp
parentbd35ec36f5d6b4e65e886eaf24f8985d86f85753 (diff)
parent0c78e49be3a258695b7f363f2d5b1cfdb93f9522 (diff)
downloadbitcoin-74f1a27f2f45af7dafcc34df766cf76d29c7c6ed.tar.xz
Merge #15134: tests: Switch one of the Travis jobs to an unsigned char environment (-funsigned-char)
0c78e49be3a258695b7f363f2d5b1cfdb93f9522 tests: Switch one of the Travis jobs to an unsigned char environment (-funsigned-char) (practicalswift) Pull request description: Switch one of the Travis jobs to an unsigned char environment (`-funsigned-char`). This will help us catch errors due to code written under the assumption that `char` has the same value range as `signed char`. The signedness of `char` is implementation-defined. Example: ``` $ uname -a Linux […] x86_64 x86_64 x86_64 GNU/Linux $ cat foo.cpp #include <iostream> int main() { char c; std::cin >> c; int i = (unsigned char)c; std::cout << i << "\n"; } $ clang++ -o foo foo.cpp $ echo -e "\xff" | ./foo 255 $ clang++ -fsigned-char -o foo foo.cpp $ echo -e "\xff" | ./foo 255 $ clang++ -funsigned-char -o foo foo.cpp $ echo -e "\xff" | ./foo 255 $ cat bar.cpp #include <iostream> int main() { char c; std::cin >> c; int i = c; std::cout << i << "\n"; } $ clang++ -o bar bar.cpp $ echo -e "\xff" | ./bar -1 $ clang++ -fsigned-char -o bar bar.cpp $ echo -e "\xff" | ./bar -1 $ clang++ -funsigned-char -o bar bar.cpp $ echo -e "\xff" | ./bar 255 ``` `gcc` chars: * signed: alpha, hppa, ia64, m68k, mips, sh, sparc, x86 * unsigned: arm, powerpc, s390 About `-funsigned-char`: > Let the type "char" be unsigned, like "unsigned char". > > Each kind of machine has a default for what "char" should be. It is either like "unsigned char" by default or like "signed char" by default. > > Ideally, a portable program should always use "signed char" or "unsigned char" when it depends on the signedness of an object. But many programs have been written to use plain "char" and expect it to be signed, or expect it to be unsigned, depending on the machines they were written for. > > This option, and its inverse, let you make such a program work with the opposite default. The type "char" is always a distinct type from each of "signed char" or "unsigned char", even though its behavior is always just like one of those two. ACKs for top commit: laanwj: ACK 0c78e49be3a258695b7f363f2d5b1cfdb93f9522 Tree-SHA512: ba04590415c0bb9a0bbd348623e57068f75274f53da7247d5c5ecad82e365a5b45893a4a491d318e82a8feb6a25f019d46e01990afb33162e2c9740d33a343d7
Diffstat (limited to 'src/qt/receivecoinsdialog.cpp')
0 files changed, 0 insertions, 0 deletions