The determination of C + + numerical range in VC

Source: Internet
Author: User

1. The Visual C + + 32-bit and 64-bit compilers recognize the types in the tables later in this article.

If the name starts with two underscores ( __ ), the data type is non-standard.

The ranges specified in the following table contain both a start value and an end value.

type name bytes Other Name range of Values
Int 4 Signed –2,147,483,648 to 2,147,483,647
unsigned int 4 Unsigned 0 to 4,294,967,295
__int8 1 Char –128 to 127
unsigned __int8 1 unsigned char 0 to 255
__int16 2 short, short int, signed short int –32,768 to 32,767
unsigned __int16 2 unsigned short, unsigned short int 0 to 65,535
__int32 4 Signed, signed int, int –2,147,483,648 to 2,147,483,647
unsigned __int32 4 unsigned, unsigned int 0 to 4,294,967,295
__int64 8 Long long, signed long long –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
unsigned __int64 8 unsigned long long 0 to 18,446,744,073,709,551,615
bool 1 No False or True
Char 1 No 128 to 127 (default)

0 to 255 (when compiling with/j)
Signed Char 1 No –128 to 127
unsigned char 1 No 0 to 255
Short 2 short int, signed short int –32,768 to 32,767
unsigned short 2 unsigned short int 0 to 65,535
Long 4 Long int, signed long int –2,147,483,648 to 2,147,483,647
unsigned long 4 unsigned long int 0 to 4,294,967,295
Long Long 8 None (equivalent to __int64) –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
unsigned long long 8 None (equivalent to unsigned __int64) 0 to 18,446,744,073,709,551,615
Enum Varies No See remarks later in this article
Floating 4 No 3.4E +/-38 (7-digit)
Double 8 No 1.7E +/-308 (15-digit)
Long double Same as Double No Same as Double
wchar_t 2 __wchar_t 0 to 65,535

2. Code portability issues, because the language standard allows portable code to be implementation-specific, it is recommended that you do not use the _ _ IntX type Because this is a data type unique to Microsoft VC.

(1) int and unsigned``int type have a size of four bytes.

However, because the language standard allows portable code to be implementation-specific, the code should not depend on int the size.

(2) The __intn type specifier declares a 8-bit, 16-bit, 32-bit, or 64-bit integer variable, where n is 8, 16, 32, or 64.

Endl

The determination of C + + numerical range in VC

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.