English 中文(简体)
长期负债的表述[重复]
原标题:Representation of Long Integers [duplicate]
This question already has answers here:
Closed 12 years ago.

Possible Duplicate:
What is the difference between an int and a long in C++?

#include <iostream>

int main()
{
    std::cout << sizeof(int) << std::endl;
    std::cout << sizeof(long int) << std::endl;
}

<<>Output>:

4
4

如何做到这一点? 是否应将中的“t的>长处大于int?

最佳回答

保证:

sizeof(int) <= sizeof(long)

sizeof(int)   * CHAR_BITS >= 16
sizeof(long)  * CHAR_BITS >= 32
CHAR_BITS                 >= 8

所有这些条件都符合:

sizeof(int)  == 4
sizeof(long) == 4
问题回答

C++ langauge never guaranteed or required long int to be bigger than int. The only thing the language is promising is that long int is not smaller than int. In many popular implementations long int has the same size as int.

它取决于语言和平台。 例如,在ISO/ANSI C中,64-bit系统“简讯”中的长期惯性为8 by,其他电动/电压为4.。

页: 1 根据<代码>int的C标准,该标准具有与short int相同的大小,intlong int相同,intlongt相同,甚至所有三者相同。 在16台轨道机上,在<代码>sizeof(int) =sizeof(short int)=2和sizeof(long int) === 关于32台轨道机的最常见安排是sizeof(int)=sizeof (long int)=4和sizeof(short int) === 2. 在64台轨道机上,可找到<条码>(直线)=2,<条码>sizeof(int)=4,和<条码>sizeof(长期为t)== 8.8





相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签