久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

int 的大小是否取決于編譯器和/或處理器?

Does the size of an int depend on the compiler and/or processor?(int 的大小是否取決于編譯器和/或處理器?)
本文介紹了int 的大小是否取決于編譯器和/或處理器?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

整數的大小是否取決于編譯器、操作系統和處理器?

Would the size of an integer depend upon the compiler, OS and processor?

推薦答案

這個問題的答案取決于我們愿意得到的實際考慮有多遠.

The answer to this question depends on how far from practical considerations we are willing to get.

最終,理論上,C 和 C++ 中的一切都依賴于編譯器,并且只依賴于編譯器.硬件/操作系統根本不重要.編譯器可以自由地實現任何厚度的硬件抽象層,并且可以完全模擬任何東西.沒有什么可以阻止 C 或 C++ 實現實現任何大小和任何表示的 int 類型,只要它足夠大以滿足語言標準中指定的最低要求.這種抽象級別的實際示例很容易獲得,例如基于虛擬機"平臺的編程語言,如 Java.

Ultimately, in theory, everything in C and C++ depends on the compiler and only on the compiler. Hardware/OS is of no importance at all. The compiler is free to implement a hardware abstraction layer of any thickness and emulate absolutely anything. There's nothing to prevent a C or C++ implementation from implementing the int type of any size and with any representation, as long as it is large enough to meet the minimum requirements specified in the language standard. Practical examples of such level of abstraction are readily available, e.g. programming languages based on "virtual machine" platform, like Java.

然而,C 和 C++ 旨在成為高度高效的語言.為了實現最高效率,C 或 C++ 實現必須考慮源自底層硬件的某些考慮因素.出于這個原因,確保每個基本類型都基于硬件直接(或幾乎直接)支持的某種表示很有意義.從這個意義上說,基本類型的大小確實取決于硬件.

However, C and C++ are intended to be highly efficient languages. In order to achieve maximum efficiency a C or C++ implementation has to take into account certain considerations derived from the underlying hardware. For that reason it makes a lot of sense to make sure that each basic type is based on some representation directly (or almost directly) supported by the hardware. In that sense, the size of basic types do depend on the hardware.

換句話說,64 位硬件/OS 平臺的特定 C 或 C++ 實現完全可以自由地將 int 實現為占用 128 位的 71 位 1 的補碼整數類型內存,使用其他 57 位作為填充位,這些位總是需要存儲編譯器作者的女朋友的生日.這種實現甚至會具有一定的實用價值:它可以用于執行 C/C++ 程序可移植性的運行時測試.但這就是該實現的實際用途將結束的地方.不要期望在普通"的 C/C++ 編譯器中看到類似的東西.

In other words, a specific C or C++ implementation for a 64-bit hardware/OS platform is absolutely free to implement int as a 71-bit 1's-complement signed integral type that occupies 128 bits of memory, using the other 57 bits as padding bits that are always required to store the birthdate of the compiler author's girlfriend. This implementation will even have certain practical value: it can be used to perform run-time tests of the portability of C/C++ programs. But that's where the practical usefulness of that implementation would end. Don't expect to see something like that in a "normal" C/C++ compiler.

這篇關于int 的大小是否取決于編譯器和/或處理器?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Algorithm to convert RGB to HSV and HSV to RGB in range 0-255 for both(將 RGB 轉換為 HSV 并將 HSV 轉換為 RGB 的算法,范圍為 0-255)
How to convert an enum type variable to a string?(如何將枚舉類型變量轉換為字符串?)
When to use inline function and when not to use it?(什么時候使用內聯函數,什么時候不使用?)
Examples of good gotos in C or C++(C 或 C++ 中好的 goto 示例)
Significance of ios_base::sync_with_stdio(false); cin.tie(NULL);(ios_base::sync_with_stdio(false) 的意義;cin.tie(NULL);)
Is TCHAR still relevant?(TCHAR 仍然相關嗎?)
主站蜘蛛池模板: 精品国产一二三区 | 日韩免费在线观看视频 | 国产成人精品亚洲 | 成av人片一区二区三区久久 | 久久机热 | 成人片在线播放 | 久久久久久毛片 | 国产精品一区在线观看 | 国产精品久久久久久久久久久久午夜片 | av免费在线观看网站 | 久久精品国产视频 | 亚洲成人精品 | 一级片黄色片 | 日韩精品一区二区三区免费视频 | 中文字幕亚洲视频 | 美国一级大黄一片免费中文 | 求av网站 | 日韩精品在线免费观看 | 怡红院久久| 欧美视频二区 | 在线观看91 | 国产va在线| 美日韩丰满少妇在线观看 | 免费国产一区 | 亚洲视频在线观看免费 | 国产精品免费一区二区三区 | 青青草久久 | 亚洲国产日本 | 成人网页 | 国产三级在线看 | 亚洲福利一区二区 | 日韩精品久久久 | 日本韩国欧美中文字幕 | 五月天婷婷影院 | 成人一区在线观看 | 成人在线视频播放 | 秋霞啪啪片 | 午夜影院在线 | 午夜视频网 | 天堂网中文 | 欧美专区在线观看 |