Long integer: Difference between revisions
→Common sizes: rm 16-bit VC++, per talk |
Ph0t0phobic (talk | contribs) |
||
Line 7: | Line 7: | ||
==C/C++ language dialects== |
==C/C++ language dialects== |
||
In later versions of [[C (programming language)|the C programming language]], a long long type is supported that doubles the capacity of the standard long to 64 bits. This type is not supported by compilers that require C code to be [[C++]] [[International Organization for Standardization|ISO]] compliant, because the long long type does not exist in C++. For an ANSI/ISO compliant compiler the minimum requirements for the specified ranges must be full filled whilst extending this range is totally valid. |
In later versions of [[C (programming language)|the C programming language]], a long long type is supported that doubles the capacity of the standard long to 64 bits. This type is not supported by compilers that require C code to be [[C++]] [[International Organization for Standardization|ISO]] compliant, because the long long type does not exist in C++. For an ANSI/ISO compliant compiler the minimum requirements for the specified ranges must be full filled whilst extending this range is totally valid.<ref>http://www.ericgiguere.com/articles/ansi-c-summary.html</ref><ref>http://flash-gordon.me.uk/ansi.c.txt</ref> This might be a problem if e.g. exchanging codes and data between platforms or doing direct hardware access using this types. Thus there are several approaches that try to overcome that problem in this previous design. Thus opposing sets of platform independent types with exact widths got designed in the long run where especially C/C++ one design is available provided by the often present header file ''[[stdint.h]]'' that got introduced first by the [[standard library]] of [[C99]]. |
||
==Common sizes== |
==Common sizes== |
Revision as of 03:23, 6 May 2010
In computer science, a long integer is a data type that can represent a whole number whose range is greater than or equal to that of a standard integer on the same machine.
A variable defined as a long integer in one programming language may be different in size to a similarly defined variable in another. In some languages this size is fixed across platforms, whilst in others it is machine dependent. In some languages this data type does not exist at all.
In practice it is usual for a long integer to require double the storage capacity of a standard integer, although this is not always the case.
C/C++ language dialects
In later versions of the C programming language, a long long type is supported that doubles the capacity of the standard long to 64 bits. This type is not supported by compilers that require C code to be C++ ISO compliant, because the long long type does not exist in C++. For an ANSI/ISO compliant compiler the minimum requirements for the specified ranges must be full filled whilst extending this range is totally valid.[1][2] This might be a problem if e.g. exchanging codes and data between platforms or doing direct hardware access using this types. Thus there are several approaches that try to overcome that problem in this previous design. Thus opposing sets of platform independent types with exact widths got designed in the long run where especially C/C++ one design is available provided by the often present header file stdint.h that got introduced first by the standard library of C99.
Common sizes
Programming language | Approval Type | Platforms | Data type name | Storage in bytes | Range (Signed) | Range (Unsigned) |
---|---|---|---|---|---|---|
C ISO/ANSI | International Standard | Unix, Windows, 16/32-bit systems |
long int, abbr. long |
4 (minimum requirement) |
−2,147,483,648 to 2,147,483,647 (minimum requirement) |
0 to 4,294,967,295 (minimum requirement) |
C++ ISO/ANSI | International Standard | Unix, Windows, 16/32-bit system |
long int, abbr. long |
4 [3] (minimum requirement) |
−2,147,483,648 to 2,147,483,647 (minimum requirement) |
0 to 4,294,967,295 (minimum requirement) |
C++/CLI | International Standard ECMA-372 |
Unix, Windows, 16/32-bit systems |
long int, abbr. long |
4 [4] (minimum requirement) |
−2,147,483,648 to 2,147,483,647 (minimum requirement) |
0 to 4,294,967,295 (minimum requirement) |
VB | Company Standard | Windows | Long | 4 [5] | −2,147,483,648 to 2,147,483,647 | N/A |
VBA | Company Standard | Windows, Mac OS | Long | 4 [6] | −2,147,483,648 to 2,147,483,647 | N/A |
SQL Server | Company Standard | Windows | BigInt | 8 | −9,223,372,036,854,775,808 to +9,223,372,036,854,775,807 | 0 to 18,446,744,073,709,551,615 |
.NET CLR/CTS | Company Standard | Windows | Long or Int64 | 8 | −9,223,372,036,854,775,808 to +9,223,372,036,854,775,807 | 0 to 18,446,744,073,709,551,615 |
Java | International/Company Standard | Java platform | long | 8 | −9,223,372,036,854,775,808 to +9,223,372,036,854,775,807 | N/A |
Pascal | ? | Windows | int64 | 8 | −9,223,372,036,854,775,808 to +9,223,372,036,854,775,807 | N/A |
References
- ^ http://www.ericgiguere.com/articles/ansi-c-summary.html
- ^ http://flash-gordon.me.uk/ansi.c.txt
- ^ "Variables. Data Types".
- ^ http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-372.pdf chapter 8.6.2 on page 12
- ^ VB 6.0 help file
- ^ "The Integer, Long, and Byte Data Types (VBA)". Retrieved 2006-12-19.