[Gambas-user] unsigned int datatype for external function
Jussi Lahtinen
jussi.lahtinen at gmail.com
Sun Jun 10 20:27:40 CEST 2018
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
> 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 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/ba47c5e3/attachment.html>
More information about the User
mailing list