Unsigned variables
-
- Addict
- Posts: 1518
- Joined: Wed Nov 12, 2008 5:01 pm
- Location: Russia
Unsigned variables
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?
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?
Re: Unsigned variables
http://www.purebasic.fr/english/viewtop ... 95#p296495User_Russian wrote:What's stopping you add unsigned variables, order not to complicate programming?
"Have you tried turning it off and on again ?"
A little PureBasic review
A little PureBasic review
Re: Unsigned variables
> 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.
> will return a negative number in place positive
49.7 days, to be precise.

I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
"PureBasic won't be object oriented, period" - Fred.
Re: Unsigned variables
+1
There's quite a few C/C++ libraries that use unsigned long/int, using those libs in PB could cause unforeseen results.
There's quite a few C/C++ libraries that use unsigned long/int, using those libs in PB could cause unforeseen results.
-
- Addict
- Posts: 1518
- Joined: Wed Nov 12, 2008 5:01 pm
- Location: Russia
Re: Unsigned variables
This should be considered when developing the program. But the lack of unsigned variables, it is further complicates.PB wrote:49.7 days, to be precise.Also, that's a Windows limitation, not PureBasic.
Re: Unsigned variables
+1Toni6 wrote:+1
There's quite a few C/C++ libraries that use unsigned long/int, using those libs in PB could cause unforeseen results.
-
- Enthusiast
- Posts: 542
- Joined: Tue Apr 24, 2012 5:08 pm
- Location: Ontario, Canada
Re: Unsigned variables
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.
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
~ Spike Milligan
- StarBootics
- Addict
- Posts: 1006
- Joined: Sun Jul 07, 2013 11:35 am
- Location: Canada
Re: Unsigned variables
Did you release this library somewhere ?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.
Regards
StarBootics
The Stone Age did not end due to a shortage of stones !
-
- Enthusiast
- Posts: 542
- Joined: Tue Apr 24, 2012 5:08 pm
- Location: Ontario, Canada
Re: Unsigned variables
NoStarBootics wrote:Did you release this library somewhere ?
For ten years Caesar ruled with an iron hand, then with a wooden foot, and finally with a piece of string.
~ Spike Milligan
~ Spike Milligan
- StarBootics
- Addict
- Posts: 1006
- Joined: Sun Jul 07, 2013 11:35 am
- Location: Canada
Re: Unsigned variables
Why not ?BorisTheOld wrote:No
The Stone Age did not end due to a shortage of stones !
-
- Enthusiast
- Posts: 542
- Joined: Tue Apr 24, 2012 5:08 pm
- Location: Ontario, Canada
Re: Unsigned variables
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.StarBootics wrote:Why not ?
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
~ Spike Milligan
Re: Unsigned variables
I hope you've never copied any code from the Tips & Tricks section...BorisTheOld wrote: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.StarBootics wrote:Why not ?

If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
-
- Enthusiast
- Posts: 542
- Joined: Tue Apr 24, 2012 5:08 pm
- Location: Ontario, Canada
Re: Unsigned variables
I don't need to.c4s wrote:I hope you've never copied any code from the Tips & Tricks section

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
~ Spike Milligan
Re: Unsigned variables
@StarBootics,
You could get something like this:
http://www.purebasic.fr/english/viewtop ... 01#p418601
Hm... reminds me of that quote of Fr34K's.
You could get something like this:

http://www.purebasic.fr/english/viewtop ... 01#p418601
Hm... reminds me of that quote of Fr34K's.
DE AA EB
-
- Enthusiast
- Posts: 542
- Joined: Tue Apr 24, 2012 5:08 pm
- Location: Ontario, Canada
Re: Unsigned variables
Interestingly, nobody asked for clarification, so I can only assume that my sample code was perfectly clear to everyone.davido wrote:You could get something like this:

For ten years Caesar ruled with an iron hand, then with a wooden foot, and finally with a piece of string.
~ Spike Milligan
~ Spike Milligan