Unsigned variables

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User_Russian
Addict
Addict
Posts: 1518
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Unsigned variables

Post by User_Russian »

I know, such a request already have on forum.
Lack of unsigned variables (4 and 8 bytes), create problems during programming.

For example, it is difficult to compare the IPv4 addresses.
It is difficult to compare the memory address. http://www.purebasic.fr/english/viewtop ... 79#p414979
After 24 days operation of the computer, the function ElapsedMilliseconds () will return a negative number in place positive.
Arithmetic shift rather than logical. http://www.purebasic.fr/english/viewtop ... 59#p401059

These are only some examples.

Dear team development PureBasic. What's stopping you add unsigned variables, order not to complicate programming?
User avatar
luis
Addict
Addict
Posts: 3893
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: Unsigned variables

Post by luis »

User_Russian wrote:What's stopping you add unsigned variables, order not to complicate programming?
http://www.purebasic.fr/english/viewtop ... 95#p296495
"Have you tried turning it off and on again ?"
A little PureBasic review
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: Unsigned variables

Post by PB »

> After 24 days operation of the computer, the function ElapsedMilliseconds ()
> will return a negative number in place positive

49.7 days, to be precise. ;) Also, that's a Windows limitation, not PureBasic.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Toni6
User
User
Posts: 45
Joined: Mon Apr 23, 2012 1:39 pm

Re: Unsigned variables

Post by Toni6 »

+1

There's quite a few C/C++ libraries that use unsigned long/int, using those libs in PB could cause unforeseen results.
User_Russian
Addict
Addict
Posts: 1518
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Re: Unsigned variables

Post by User_Russian »

PB wrote:49.7 days, to be precise. ;) Also, that's a Windows limitation, not PureBasic.
This should be considered when developing the program. But the lack of unsigned variables, it is further complicates.
User avatar
Tenaja
Addict
Addict
Posts: 1959
Joined: Tue Nov 09, 2010 10:15 pm

Re: Unsigned variables

Post by Tenaja »

Toni6 wrote:+1

There's quite a few C/C++ libraries that use unsigned long/int, using those libs in PB could cause unforeseen results.
+1
BorisTheOld
Enthusiast
Enthusiast
Posts: 542
Joined: Tue Apr 24, 2012 5:08 pm
Location: Ontario, Canada

Re: Unsigned variables

Post by BorisTheOld »

In the past, Fred has been quoted as saying, "we don't plan to add further unsigned types". So I take this to mean that unsigned types won't be added any time soon.

As a result, I've done what any programmer would do -- I've written a small library of functions for manipulating unsigned integers. End of problem. A day spent writing a few short procedures in PB ASM is all that it takes.

No programming language does everything we would like it to do. So writing a few macros or library functions to fill the gap is just part of creating an application.

As I've said before, programming is not rocket science. Putting together a personalized "toolkit" helps us learn our trade and become better programmers.
For ten years Caesar ruled with an iron hand, then with a wooden foot, and finally with a piece of string.
~ Spike Milligan
User avatar
StarBootics
Addict
Addict
Posts: 1006
Joined: Sun Jul 07, 2013 11:35 am
Location: Canada

Re: Unsigned variables

Post by StarBootics »

BorisTheOld wrote:... I've written a small library of functions for manipulating unsigned integers. End of problem. A day spent writing a few short procedures in PB ASM is all that it takes.
Did you release this library somewhere ?

Regards
StarBootics
The Stone Age did not end due to a shortage of stones !
BorisTheOld
Enthusiast
Enthusiast
Posts: 542
Joined: Tue Apr 24, 2012 5:08 pm
Location: Ontario, Canada

Re: Unsigned variables

Post by BorisTheOld »

StarBootics wrote:Did you release this library somewhere ?
No
For ten years Caesar ruled with an iron hand, then with a wooden foot, and finally with a piece of string.
~ Spike Milligan
User avatar
StarBootics
Addict
Addict
Posts: 1006
Joined: Sun Jul 07, 2013 11:35 am
Location: Canada

Re: Unsigned variables

Post by StarBootics »

BorisTheOld wrote:No
Why not ?
The Stone Age did not end due to a shortage of stones !
BorisTheOld
Enthusiast
Enthusiast
Posts: 542
Joined: Tue Apr 24, 2012 5:08 pm
Location: Ontario, Canada

Re: Unsigned variables

Post by BorisTheOld »

StarBootics wrote:Why not ?
Because it's part of my programming "toolkit", carefully crafted over the past 50 years to allow me to make a modest living using the talent that the Gods have bestowed upon me.

If you care to send me your requirements I'll prepare a quotation for us to do the work for you.

Of course, you might try doing it yourself, in which case I'll be happy to help, at no charge to you, with any problems you might have.
For ten years Caesar ruled with an iron hand, then with a wooden foot, and finally with a piece of string.
~ Spike Milligan
c4s
Addict
Addict
Posts: 1981
Joined: Thu Nov 01, 2007 5:37 pm
Location: Germany

Re: Unsigned variables

Post by c4s »

BorisTheOld wrote:
StarBootics wrote:Why not ?
Because it's part of my programming "toolkit" [...] If you care to send me your requirements I'll prepare a quotation for us to do the work for you.
I hope you've never copied any code from the Tips & Tricks section... ;)
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
BorisTheOld
Enthusiast
Enthusiast
Posts: 542
Joined: Tue Apr 24, 2012 5:08 pm
Location: Ontario, Canada

Re: Unsigned variables

Post by BorisTheOld »

c4s wrote:I hope you've never copied any code from the Tips & Tricks section
I don't need to. :)

I believe that nothing is learned without risking failure. So I'll help someone to the best of my abilities if he takes a chance and tries for himself first. But if he wants an answer with zero effort, then I won't waste my time on him.
For ten years Caesar ruled with an iron hand, then with a wooden foot, and finally with a piece of string.
~ Spike Milligan
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: Unsigned variables

Post by davido »

@StarBootics,

You could get something like this: :wink:

http://www.purebasic.fr/english/viewtop ... 01#p418601


Hm... reminds me of that quote of Fr34K's.
DE AA EB
BorisTheOld
Enthusiast
Enthusiast
Posts: 542
Joined: Tue Apr 24, 2012 5:08 pm
Location: Ontario, Canada

Re: Unsigned variables

Post by BorisTheOld »

davido wrote:You could get something like this: :wink:
Interestingly, nobody asked for clarification, so I can only assume that my sample code was perfectly clear to everyone. :mrgreen:
For ten years Caesar ruled with an iron hand, then with a wooden foot, and finally with a piece of string.
~ Spike Milligan
Post Reply