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

Jussi Lahtinen jussi.lahtinen at ...626...
Wed Jan 22 14:36:33 CET 2014


If you declare variable as integer in Gambas and pass it as unsigned 32bit
variable to lib made with C, then I don't think the lib will notice any
difference. It's just that Gambas will show large values of that variable
as negative numbers.

Jussi


On Wed, Jan 22, 2014 at 3:19 PM, wally <wally at ...2037...> wrote:

> 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
> >
>
>
>
> ------------------------------------------------------------------------------
> 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