Bart <
b...@freeuk.com> writes:
>On 06/12/2019 16:30,
bol...@nowhere.co.uk wrote:
>> On Fri, 6 Dec 2019 16:20:07 +0000
>> Bart <
b...@freeuk.com> wrote:
>>> On 04/12/2019 08:40, Paavo Helde wrote:
>
>>>> This is basically so because long happened to be 32-bit in 16-bit DOS 35
>>>> years ago, and MS used it a lot instead of 16-bit int (which was indeed
>>>> unusable for many purposes). As a result, now they cannot change 'long'
>>>> to 64-bit because they have abused it so much.
>>>>
>>>
>>> At least, on Windows 'long' is consistently 32-bit.
>>>
>>> On Linux, as I understand it, 'long' is either 32 bits or 64 bits,
>>> depending on whether the OS is 32 or 64 bits.
>>>
>>> This means that if you use 'long' on Linux64, and depend on it being 64
>>> bits, the same program might not work properly on Linux32.
>>>
>>> And if a 'long' is wide enough on Linux32, then on Linux64 it will
>>> wastefully be 64 bits (ie. an array of 'long' takes twice the memory).
>>>
>>> (Suggestion: don't bother with 'long' at all; either use plain int (32
>>> bits on most relevant machines), or long long int (64 bits), which has
>>> the -LL suffix for constants that need to be considered 64 bits.)
>>
>> #include <stdint.h>
>>
>> int32_t myint;
>> int64_t mylong;
>
>So, do you write 3, 3L or 3LL if you wanted three be considered a 'long'
>type in calculations?