This is mnoGoSearch's cache of https://lists.gambas-basic.org/pipermail/user/2014-January/046975.html. It is a snapshot of the page as it appeared during last crawling. The current page could have changed in the meantime.

Last modified: Wed, 22 Jan 2014, 14:19:31 CET    Size: 6216
[Gambas-user] How to handle unsigned Integer, Short, Long

[Gambas-user] How to handle unsigned Integer, Short, Long

wally wally at ...2037...
Wed Jan 22 14:19:31 CET 2014


Hello

@Jussi,

i must handle a lot of 4byte uint32_t values which represents
node IP addresses of devices in a rs232 ring network.
I know i might use long instead of unsigned 4byte integer,
but i expected there is a keyword "unsigned" somewhere to
declare as needed.
The "long" approach for uint32_t is not very elegant solution.

So answer seems to be, Gambas3 does not allow to declare
unsigned variables as there are e.g. : uint32_t andd friends.

Is this correct so far ?    <-- seems yes, as Benoit wrote.

@Benoit:

Alas you have no unsigned datatypes in Gambas. Maybe in a future Gambas 4?

You have to use signed version, and be careful with the arithmetic you
are doing.


If it is not too much work it would be nice to have unsigned in version 4.
Yes, exactly, the maths is the problem. In c i get overflow warnings at 
lest.

wally


On 01/22/2014 12:43 PM, Jussi Lahtinen wrote:
> Instead of unsigned integer and short, why not just normal signed long? It
> can hold same values. Integer is variable of 32 bits and it's declaration
> determines how the first bit is interpreted. So in some cases it doesn't
> matter.
> Where do you need these exactly?
>
> Jussi
>
>
> On Wed, Jan 22, 2014 at 11:15 AM, wally <wally at ...2037...> wrote:
>
>> Hello,
>>
>> Where can i find information and example code on:
>>
>> How to declare and handle *_unsigned_*__Integer, Short, Long in Gambas3 ?
>>
>> thank you wally
>>
>>
>> ------------------------------------------------------------------------------
>> CenturyLink Cloud: The Leader in Enterprise Cloud Services.
>> Learn Why More Businesses Are Choosing CenturyLink Cloud For
>> Critical Workloads, Development Environments & Everything In Between.
>> Get a Quote or Start a Free Trial Today.
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Gambas-user mailing list
>> Gambas-user at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>
> ------------------------------------------------------------------------------
> CenturyLink Cloud: The Leader in Enterprise Cloud Services.
> Learn Why More Businesses Are Choosing CenturyLink Cloud For
> Critical Workloads, Development Environments & Everything In Between.
> Get a Quote or Start a Free Trial Today.
> http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>





More information about the User mailing list