GCC compiles program using sizeof(long)=8
and Visual Studio has sizeof(long)=4
. How to set sizeof(long) to 8 bytes on Winows x64?
Is there any way to set C++ long type size with 8 bytes (x64)?
1.3k views Asked by AudioBubble At
2
There are 2 answers
0
On
It's a common migration issue:https://msdn.microsoft.com/en-us/library/3b2e7499.aspx. As said before, the spec doesn't say specifically what size a long is and done platforms will be 4 and sone 8.
The actual size of
long
isn't specified to be an exact number of bytes, only the range of values that it must be able to represent. You could however use fixed width integersThis, along with other fixed width integer types, are available in
<cstdint>