
c++ - What's the 'long' data type used for? - Stack Overflow
I noticed stuff called "long int" or even "long long"! Is it a data type or a modifier? long int is the same as long (just as short int is the same as short). long long is a distinct data type introduced by several compilers and adopted by C++0x. Note that there is no such thing as long long long: error: 'long long long' is too long for GCC
What is the difference between "long", "long long", "long int", and ...
Sep 24, 2013 · Hence long on its own is neither a type nor a modifier as your question posits, it's simply a specifier for the long int type. Ditto for long long being a specifier for the long long int type. Although the C++ standard itself doesn't specify the minimum ranges of integral types, it does cite C99, in 1.2 Normative references, as applying.
What does the C++ standard say about the size of int, long?
signed char: -127 to 127 (note, not -128 to 127; this accommodates 1's-complement platforms) unsigned char: 0 to 255 "plain" char: -127 to 127 or 0 to 255 (depends on default char signedness) signed short: -32767 to 32767 unsigned short: 0 to 65535 signed int: -32767 to 32767 unsigned int: 0 to 65535 signed long: -2147483647 to 2147483647 ...
c++ - what is long long type? - Stack Overflow
Jun 15, 2011 · ISO C99 supports data types for integers that are at least 64 bits wide, and as an extension GCC supports them in C90 mode and in C++. Simply write long long int for a signed integer, or unsigned long long int for an unsigned integer. To make an integer constant of type long long int, add the suffix LL' to the integer. To make an integer ...
c++ - Difference between long and int data types - Stack Overflow
May 23, 2009 · The long must be at least the same size as an int, and possibly, but not necessarily, longer. On common 32-bit systems, both int and long are 4-bytes/32-bits, and this is valid according to the C++ spec. On other systems, both int and long long may be a different size. I used to work on a platform where int was 2-bytes, and long was 4-bytes.
c++ - "long int", "long long" Data Types - Stack Overflow
May 29, 2010 · long int is just the full form of long, and is distinct from, for example unsigned long int and so on. This is not new in C++0x. This is not new in C++0x. long long is common in compilers already today; for compatibility, it is conventional that both long and int are 32 bits even on 64-bit architectures; long long specifies 64-bits in such ...
types - long long in C/C++ - Stack Overflow
The letters 100000000000 make up a literal integer constant, but the value is too large for the type int. You need to use a suffix to change the type of the literal, i.e. long long num3 = 100000000000LL; The suffix LL makes the literal into type long long. C is not "smart" enough to conclude this from the type on the left, the type is a ...
What range of values can integer types store in C++?
Nov 30, 2009 · For an unsigned data type, there isn't any sign bit and all bits are for data ; whereas for a signed data type, MSB is indicating a sign bit and the remaining bits are for data. To find the range, do the following things: Step 1: Find out number of bytes for the given data type. Step 2: Apply the following calculations.
c++ - What are the lengths of common datatypes? - Stack Overflow
Oct 2, 2008 · long long: 64-bit ( if supported) The C standard basiucally says that a long can't be shorter than an int which can't be shorter than a short , etc... For 64-bit CPUs, those often don't change, but you MUST beware that pointers and ints are frequently not the same size:
Long Vs. Int C/C++ - What's The Point? - Stack Overflow
Sep 18, 2011 · "a long in C/C++ is the same length as an int." Not always. The C++ standard specifies that an int be the "natural" size for the processor, which may not always be as big as a long. The standard also guarantees that a long is at least as long as an int, so the fact that they are equal sizes are not always guaranteed. –