Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


Representing Unsigned Values Inside Basic4ppc itself


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-11-2007, 05:35 PM
Senior Member
 
Join Date: May 2007
Posts: 101
Default Representing Unsigned Values Inside Basic4ppc itself

Hi.
What data types in Basic4ppc am I able to use to read and write unsigned values to and from a file? E.G. An unsigned 32-bit Integer? Are 64-bit integers equivalent, or decimals, or doubles, or single? Thanks.
Reply With Quote
  #2 (permalink)  
Old 11-11-2007, 05:56 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,334
Default

How did you save the unsigned values?
Reply With Quote
  #3 (permalink)  
Old 11-11-2007, 07:29 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,896
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

There aren't types inside Basic4PPC as such as it is very weakly typed. You can think of its' variables as strings that are converted to and from numbers and booleans as and when required. Similar to the old Variant variables in Visual Basic.

Erel told me that all arithmetic inside B4PPC is performed as Doubles. Strong data types only mean something on the perimeter of the B4PPC universe when they are converted on the way in or out of the B4PPC world.

See the BinaryFile library for examples of when you can specify the conversion that you need. When interfacing to objects from component libraries B4PPC automatically converts those data types it is aware of - including Control data types.
Reply With Quote
  #4 (permalink)  
Old 11-11-2007, 07:53 PM
Senior Member
 
Join Date: May 2007
Posts: 101
Default

Hi. I actually haven't started working on anything involving such types, however I want to port over another source code from another language to Basic4ppc for use in my program but the language uses lots of unsigned numbers for storing data to a file. So with Basic4ppc does it really matter how data is stored as long as I use the same techniques to get it back? E.G. An unsigned integer in this other language ranges from 0 to 42949672955, where as signed 32-bit Integers range from -2147483648 to +21474836477. I guess my question is can Basic4ppc handle these and what array types do I need to use to store and retrieve values like these? What's confusing is that both the decimals and doubles described in General.txt have the letter E in them and I am not sure how to interpret whether or not those types are the right ones for arrays holding huge values like the ones listed above. Thanks.
Reply With Quote
  #5 (permalink)  
Old 11-11-2007, 08:40 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,334
Default

A regular variable (which is based on 64 bit floating point) can handle these numbers without any loss.
Reply With Quote
  #6 (permalink)  
Old 11-12-2007, 09:09 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,896
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Quote:
Originally Posted by Louis View Post
I guess my question is can Basic4ppc handle these and what array types do I need to use to store and retrieve values like these?
If you are not going to pass the arrays themselves to a library but are only going to read/write them from/to a file just use an ordinary array in B4PPC. If you were going to pass the array itself to a library you would need to declare the array as being of the type expected by the library as, for efficiency, B4PPC does not automatically convert entire arrays when passing them to libraries.


Erel - for clarification. I haven't tried it but does B4PPC automatically convert individual array elements when passing them singly? e.g. array(x) of an array of Bytes being passed as an Int32 parameter to a library.
Reply With Quote
  #7 (permalink)  
Old 11-12-2007, 09:21 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,334
Default

Quote:
Erel - for clarification. I haven't tried it but does B4PPC automatically convert individual array elements when passing them singly? e.g. array(x) of an array of Bytes being passed as an Int32 parameter to a library.
Yes. It doesn't matter where the value comes from as long as it is a single convertible value.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Array inside Struct fjsantos Questions & Help Needed 2 06-17-2008 05:28 PM
Colour Values Zenerdiode Questions & Help Needed 2 05-20-2008 06:01 AM
Concatenation of values shown in a textbox mozaharul Questions & Help Needed 8 03-20-2008 08:36 AM
Wrong values on GPS Roadrunner Bug Reports 1 01-31-2008 08:10 PM
Move an image inside an image control Cableguy Questions & Help Needed 5 05-14-2007 08:40 PM


All times are GMT. The time now is 12:59 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0