C???????????????????С??
???????????? ???????[ 2016/11/9 10:15:58 ] ????????C???? .NET
??????????????????????????????д?????????8λ?1?????????? uint32_t mask = ~((uint8_t)0); ???????????????????? 0xffffffff ??????????????????????????????д???????????£?
#include <stdint.h>
#include <iostream>
using namespace std;
int main()
{
uint8_t z = 0;
uint32_t x = ~(uint8_t)0;
uint32_t y = (uint8_t)~0;
cout << typeid(~(uint8_t)0).name() << endl;
cout << typeid((uint8_t)~0).name() << endl;
cout << x << endl;
cout << y << endl;
}
????????????(macOS?? Clang)???
????i
????h
????4294967295
????255
??????????????????д?????????????????????????????????????? typeid ????????????????????????????????????????? h ??????? uint8_t ????????????? int ???????????????????漲??????????????????????????? C99 ?????????????? 6.5 ?????漲???£?
????????? 6.5.3.3 ????????????
???????????????λ???????????????? uint8_t ?????????????????????????????????????????? -1 ????????????????????????????????? bit ????1????????????????е?λ???????1???
?????????????????????????????????????spec?ɡ?
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11