Re: 'long long' not standard
Just use long long. C++0x will standardize it anyway, and you don't have any better options.
By the way, long is a 32-bit type on 64-bit Windows, too. That's the part that's *really* strange. (It's 64 bits on 64-bit Linux.)
Re: 'long long' not standard
Lang Lang is a fabulous pianist. I heard him play the first Tchaikovsky concerto with the Cleveland Orchestra a few seasons ago.
Re: 'long long' not standard
Quote:
Originally Posted by
Lindley
Just use long long. C++0x will standardize it anyway, and you don't have any better options.
By the way, long is a 32-bit type on 64-bit Windows, too. That's the part that's *really* strange. (It's 64 bits on 64-bit Linux.)
On 64-bit windows, long is only 32 bits? What the? That means 'int' must be less than or equal to 32 bits!!
Re: 'long long' not standard
Technically it's a property of the compiler rather than OS:
http://en.wikipedia.org/wiki/64-bit#...ic_data_models
Re: 'long long' not standard
Quote:
Originally Posted by
0xC0000005
Lang Lang is a fabulous pianist. I heard him play the first Tchaikovsky concerto with the Cleveland Orchestra a few seasons ago.
I think, he's a bit overrated. I also heard him a couple years back and thought he was good but not fabulous. Or maybe it's just that here in Germany there is too much fuzz being made about him...
Re: 'long long' not standard
Re: 'long long' not standard
Quote:
Originally Posted by
0xC0000005
Lang Lang is a fabulous pianist. I heard him play the first Tchaikovsky concerto with the Cleveland Orchestra a few seasons ago.
And Ling Ling was a famous zoo animal.
Anyway, the "bitness" used by a compiler is usually tied to the CPU architecture. However nothing stops a compiler to have integers of any bits and on any platform. In these cases, the compiler would emulate an "n-bit" integer via software, not hardware,
This was the case with old DOS compilers that had 32-bit longs. Even though the Intel architecture at that time was 16-bit, 32-bit longs were implemented by using emulation (if you debugged into the calls that generated the 32-bit longs, you actually could see a 10 or so line assembly routine just to generate the long numbers).
Regards,
Paul McKenzie
Re: 'long long' not standard
To expand on what Paul said, IIRC, the standard only says:
Code:
sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long)
So, theoretically, if a compiler implements a char as 7 bits, your longs could also be 7 bits!
Viggy
Re: 'long long' not standard
Quote:
Originally Posted by MrViggy
So, theoretically, if a compiler implements a char as 7 bits, your longs could also be 7 bits!
As I pointed out in the input unsigned long from file thread, there are minimum ranges as well. A compiler that implements a char as 7 bits would not conform to the C++ standard, since the C++ standard refers to the C standard, which mandates that CHAR_BIT be at least 8.
Re: 'long long' not standard
Quote:
Originally Posted by
MrDoomMaster
I need access to 64-bit integrals on 32-bit architectures (Windows XP, in this example). Is there anything I can do?
You'll have to look at the compiler specification. Like say you use the Microsoft compiler,
http://msdn.microsoft.com/en-us/library/cc953fe1.aspx
Then you define your own long primitive somewhere globally, like
typedef __int64 LongInt;
You use LongInt at places in code where you want to make sure you have a 64 bit int. If you change compilers you just adjust the one global typedef.