【问题标题】:What is the difference between the size required to store a variable and "memory required to store a variable"?存储变量所需的大小和“存储变量所需的内存”有什么区别?
【发布时间】:2017-08-31 02:01:35
【问题描述】:

对于不同的操作系统平台会不会有所不同。假设变量占用的内存字节数在 Windows/Linux 中会有所不同。

【问题讨论】:

    标签: memory operating-system


    【解决方案1】:

    非正式地当有人问以下任何问题时?

    What is the size required to store a variable?
    

    What is the memory required to store a variable?
    

    被问到的实际问题是:

    What is the size of the memory required to define the variable?
    

    一个变量不过是内存,而变量标识符是用来标识的,我们说的具体字节是什么?

    是的,bytes 中的变量大小对于不同的操作系统/架构是不同的。这就是我们拥有cross-platform 数据类型的原因。

    例如:在C 中,我们有整数数据类型,如int16_tint32_t,它们将分别占用16 bits32 bits 内存,而int 可以占用不同数量的@ 987654332@ 在不同的机器上。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-06-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-03-18
      • 2021-11-20
      • 1970-01-01
      • 2021-07-14
      相关资源
      最近更新 更多