[Gambas-user] unsigned int datatype for external function
Demosthenes Koptsis
demosthenesk at gmail.com
Sun Jun 10 20:05:57 CEST 2018
size_t in c holds values 0 to 4,294,967,295
gambas integer holds -2.147.483.648...+2.147.483.647
gambas long holds
-9.223.372.036.854.775.808...+9.223.372.036.854.775.807
so i thing long is the correct choice.
Although, long is 8 bytes and size_t is 4 bytes
Will be there any issue if i use 8 bytes long in place of 4 byte datatype?
On 06/10/2018 08:48 PM, T Lee Davidson wrote:
> On 06/10/2018 01:42 PM, Jussi Lahtinen wrote:
>> An integer type is obviously not wide enough.
>>
>>
>> It is. You need 32 bits and Gambas integer is 32 bits. Gambas just interprets/displays the most significant bit as sign bit.
>>
>>
> That means that the Gambas integer type is only 31 (+ 1) bits wide. Not wide enough to hold a 32-bit unsigned integer if the
> highest bit is reserved for the sign bit.
>
> So then, if it is wide enough as you say, how would one manage a 32-bit unsigned integer in a 32-bit signed datatype?
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20180610/73c845e4/attachment.html>
More information about the User
mailing list