zoukankan      html  css  js  c++  java
  • C++编程:32位机与64位机数据大小

    32位机与64位机数据大小


    32位编译器:

          char :1个字节
          char*(即指针变量): 4个字节(32位的寻址空间是2^32, 即32个bit,也就是4个字节。同理64位编译器)
          short int : 2个字节
          int:  4个字节
          unsigned int : 4个字节
          float:  4个字节
          double:   8个字节
          long:   4个字节
          long long:  8个字节
          unsigned long:  4个字节
     
      64位编译器:
     
          char :1个字节
          char*(即指针变量): 8个字节
          short int : 2个字节
          int:  4个字节
          unsigned int : 4个字节
          float:  4个字节
          double:   8个字节
          long:   8个字节
          long long:  8个字节
          unsigned long:  8个字节

    我要说几点:
     
    我们一把情况下说,在设计关于底层的API的时候,最喜欢使用的就是char类型!
    原因很简单,就是,字节是八位,而且,几乎在所有的机器编程里,一个字节是程序员最喜欢接受的最小的存储单位(而不是bit,位实在是太小了,不太实用!)
     
    根据上面的数据,我们也知道这么几点:
    • 在32位核64位的计算机里:指针是不一样的,是以位数为基础的
    • long核unsigned long也是不一样的,他是根据机器的最大的字节来算的
  • 相关阅读:
    codeforces 666C Codeword
    codeforces 156D Clues(prufer序列)
    codeforces 633E Startup Funding(浮点数处理)
    codeforces 932E Team Work(组合数学、dp)
    codeforces 1000F One Occurrence(线段树、想法)
    codeforces 812E Sagheer and Apple Tree(思维、nim博弈)
    写点文字
    00000
    省选前干些奇怪的事情
    PE415
  • 原文地址:https://www.cnblogs.com/xujintao/p/7499889.html
Copyright © 2011-2022 走看看