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

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

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

問題描述

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

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++ 中的一切都依賴于編譯器,并且只依賴于編譯器.硬件/操作系統(tǒng)根本不重要.編譯器可以自由地實現任何厚度的硬件抽象層,并且可以完全模擬任何東西.沒有什么可以阻止 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 位作為填充位,這些位總是需要存儲編譯器作者的女朋友的生日.這種實現甚至會具有一定的實用價值:它可以用于執(zhí)行 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中文在线 | 国产成人在线免费视频 | 国产视频成人 | 亚洲视频精品 | 国产精品久久久久久久久久久久午夜片 | 日韩在线免费 | 91小视频在线观看 | 免费a视频 | 黄色xxxxx | 手机在线免费看av | 三上悠亚激情av一区二区三区 | аⅴ资源新版在线天堂 | 毛片aaa| 九九精品在线观看 | 精品久久久久久久久久久 | 国产午夜视频在线观看 | av手机在线免费观看 | 亚洲精品一二三区 | 高跟肉丝丝袜呻吟啪啪网站av | 精品久久久久久久久久久久久久 | 伊人综合影院 | av网站在线看 | 成年人视频网站 | 亚洲黄视频| 亚洲精品一二区 | 欧美三级三级三级爽爽爽 | 男人的天堂在线视频 | 久久久香蕉 | 亚洲123区 | 91观看 |