zoukankan      html  css  js  c++  java
  • 坑爹!

    读到0x1A时,fread就认为结束!

    今天调到的bug,以解决

    unsigned int16 范围是从0-65535 十六进制是 0X0000 - 0XFFFF 
    int16 范围是 -32768-32767 负数以补码方式储存 

    对一个整数的补码再求补码,等于该整数自身。

    补码 = 反码+1

    -5的原码(10000101)→符号位不变(10000101)→数值位取反(11111010)→加1(11111011)
    所以-5的补码是11111011
     
    原码 有符号的类型以最高位为符号位,1为负,0为正
     
     
     
     
     
    unsigned int t = 2147483680

    内存中是
    t
    0x80000020  
    1000 0000 0000 0000 0000 0000 0010 0000
    符号位不变 取反

    1111 1111 1111 1111 1111 1111 1101 1111
    除符号位
    111 1111 1111 1111 1111 1111 1101 1111
    2147483615
    加一
    2147483616
    111 1111 1111 1111 1111 1111 1110 0000
    得补码
    1111 1111 1111 1111 1111 1111 1110 0000
    signed int t = -2147483616
     
    conclusion:-2147483616 is in the C memory with the form of its completion code:1000 0000 0000 0000 0000 0000 0010 0000
     
    int - short int 16
       - long int 32
    int 16 or 32 depends on compiler
     
    char = (unsigned)char
     
    int,short, long signed
     
     
     
     
     
     
    const int * u; //指向const int 的指针
    int const * u; //同上
    int * const u; //指向int的指针 
    int const * const u; //指向const 对象的const 指针
    const int * const u; //同上
  • 相关阅读:
    linux —— 学习笔记(汇总)
    linux —— ubuntu 初次安装问题
    更改CMD默认的初始路径
    深入浅出理解linux inode结构
    重拾简单的linux指令之info 【转】
    Python 中数据的序列化和反序列化(json处理)
    day07
    Python 的反射机制
    Python 的 __new__()方法与实例化
    Classes as objects
  • 原文地址:https://www.cnblogs.com/faeriesoft/p/4192771.html
Copyright © 2011-2022 走看看