问题标签 [signed-integer]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
3 回答
65 浏览

c - 为什么`(char)~0`和`(unsigned char)~0`返回不同宽度的值?

我在编写一个试图打印 UTF-8 字符的组成字节值的程序时遇到了这个问题。

这是我为测试各种~0操作而编写的程序:

我很难理解为什么char会在产生int-sized 值时unsigned char产生char-sized 值。