[Gambas-user] unsigned int datatype for external function

Demosthenes Koptsis demosthenesk at gmail.com
Sun Jun 10 20:30:06 CEST 2018


Thanks Jussi!


On 06/10/2018 09:27 PM, Jussi Lahtinen wrote:
> Use interger, otherwise you will start to experience random unexpected 
> behaviour.
> However, keep in mind that passing values from Gambas greater, than 
> 31bit may not be straightforward (they look like negative values in 
> Gambas).
>
>
> Jussi
>
> On Sun, Jun 10, 2018 at 9:20 PM, Demosthenes Koptsis 
> <demosthenesk at gmail.com <mailto:demosthenesk at gmail.com>> wrote:
>
>     so your advice is to use Integer not Long.
>
>     is this right?
>
>
>     On 06/10/2018 09:10 PM, Jussi Lahtinen wrote:
>>
>>         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?
>>
>>
>>     They both contain 32bits of information, unsigned or not. Signed
>>     integer only means that the most significant bit is reserved for
>>     the sign.
>>     When the library reads the signed value, it ignores the original
>>     meaning of the most significant bit, because it assumes it as
>>     unsigned.
>>
>>
>>     Jussi
>>
>>
>>
>>
>>
>>     ----[ Gambas mailing-list is hosted byhttps://www.hostsharing.net  ]----
>
>
>
>     ----[ Gambas mailing-list is hosted by https://www.hostsharing.net
>     ]----
>
>
>
>
> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20180610/561823a2/attachment.html>


More information about the User mailing list