Page 1 of 2
					
				Unsigned variables
				Posted: Thu Aug 01, 2013 11:26 am
				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?
 
			 
			
					
				Re: Unsigned variables
				Posted: Thu Aug 01, 2013 12:19 pm
				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 
			 
			
					
				Re: Unsigned variables
				Posted: Thu Aug 01, 2013 1:40 pm
				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.
 
			 
			
					
				Re: Unsigned variables
				Posted: Thu Aug 01, 2013 2:00 pm
				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.
			 
			
					
				Re: Unsigned variables
				Posted: Thu Aug 01, 2013 2:07 pm
				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.
 
			 
			
					
				Re: Unsigned variables
				Posted: Fri Aug 02, 2013 5:52 am
				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
 
			 
			
					
				Re: Unsigned variables
				Posted: Fri Aug 02, 2013 3:42 pm
				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.
			 
			
					
				Re: Unsigned variables
				Posted: Fri Aug 02, 2013 4:01 pm
				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
 
			 
			
					
				Re: Unsigned variables
				Posted: Fri Aug 02, 2013 4:28 pm
				by BorisTheOld
				StarBootics wrote:Did you release this library somewhere ?
No
 
			 
			
					
				Re: Unsigned variables
				Posted: Fri Aug 02, 2013 5:48 pm
				by StarBootics
				BorisTheOld wrote:No
Why not ?
 
			 
			
					
				Re: Unsigned variables
				Posted: Fri Aug 02, 2013 7:12 pm
				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.
 
			 
			
					
				Re: Unsigned variables
				Posted: Fri Aug 02, 2013 8:33 pm
				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... 

 
			 
			
					
				Re: Unsigned variables
				Posted: Fri Aug 02, 2013 8:58 pm
				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.
 
			 
			
					
				Re: Unsigned variables
				Posted: Fri Aug 02, 2013 8:59 pm
				by davido
				@StarBootics,
You could get something like this:  
 
http://www.purebasic.fr/english/viewtop ... 01#p418601
Hm... reminds me of that quote of Fr34K's.
 
			 
			
					
				Re: Unsigned variables
				Posted: Fri Aug 02, 2013 9:23 pm
				by BorisTheOld
				davido wrote:You could get something like this:  

 
Interestingly, nobody asked for clarification, so I can only assume that my sample code was perfectly clear to everyone.  
