Basic4ppc - Windows Mobile Development  

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

Basic4ppc Wishlist Missing any feature?


Dim variable c% as Double


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-27-2008, 07:43 AM
Basic4ppc Veteran
 
Join Date: Nov 2007
Posts: 316
Awards Showcase
Beta Tester 
Total Awards: 1
Default Dim variable c% as Double

Typing a variable as an Integer is something we have chatted about before.

Basic4ppc is ingenious in the way it parses the code so it can run through the Micro$oft C compiler, but it stores all vars as strings which get converted if they are numbers;

So anything like c=c+1 involves transformations from variable held as string into number then back again!

In speed critical routines Ive used c(0)=c(0)+1 because you can type arrays as integers

In version 6.4 can we have a neater way to do simple typing. My suggestion would be that any var ending in the percent sign is stored as a Double and then the conversion routines can be omitted by the parser.

e;g; c%=c%+1
This will give faster, more compact code and fits with Basic conventions that % represents a numerical variable.

p.s; Basic4ppc is great - this addition will make it near perfect! lol!

Last edited by colin9876 : 05-27-2008 at 07:56 AM.
Reply With Quote
  #2 (permalink)  
Old 05-27-2008, 11:12 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,706
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Quote:
Originally Posted by colin9876 View Post
In My suggestion would be that any var ending in the percent sign is stored as a Double and then the conversion routines can be omitted by the parser
To be pedantic (yet again !) it should be a # which is historic Basic for a double, % was used for 16 bit integers. But yes I would like that too even if it only worked in optimised compile and was treated like a normal variable in IDE/legacy compile.
Reply With Quote
  #3 (permalink)  
Old 05-27-2008, 03:52 PM
Basic4ppc Veteran
 
Join Date: Nov 2007
Posts: 316
Awards Showcase
Beta Tester 
Total Awards: 1
Default variable#

Great Im all for keeping with convention
number# would be fine

So how about it Erel, when I asked last year u said u would think about it?

It would be much faster and neater for numerical operations - if u look at the generated C code a fair chunk of the processor work is converting number strings into doubles then back again into strings!

Last edited by colin9876 : 05-27-2008 at 03:56 PM.
Reply With Quote
  #4 (permalink)  
Old 05-27-2008, 05:16 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,143
Default

Quote:
if u look at the generated C code
No need to look

The next major update will allow declaring regular variables in a specific type (local and global).
Reply With Quote
  #5 (permalink)  
Old 05-27-2008, 06:27 PM
Senior Member
 
Join Date: Apr 2007
Location: Copenhagen
Posts: 141
Default

Very nice / Björn
Reply With Quote
  #6 (permalink)  
Old 05-27-2008, 10:30 PM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Switzerland
Posts: 677
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

That's pretty good news.
I prefer that way rather than the specific end character like in the older Basics.

Thank's Erel.

Best regards.
__________________
Klaus
Switzerland
Reply With Quote
  #7 (permalink)  
Old 05-28-2008, 11:29 AM
Basic4ppc Veteran
 
Join Date: Nov 2007
Posts: 316
Awards Showcase
Beta Tester 
Total Awards: 1
Default faster!

Just for the record unlike some of you pureists - Im not a fan of TYPEing for the sake of it, its just for speed reasons (the PPCs are still not fast with some programs, and all those extra calls to the conversion routines slow it down more)

Apart from the speed advantage - I cant see any advantage in TYPEing variables (especially for all u desktop guys who rarely actually run these codes on the slower ppc devices anyway lol)

Is there any advantage that Im missing apart from the speed?

I still hope that TYPEing variables will be optional, as I may only bother declaring them as numbers etc in speed critical loops etc

Last edited by colin9876 : 05-28-2008 at 11:32 AM.
Reply With Quote
  #8 (permalink)  
Old 05-28-2008, 11:39 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,143
Default

Type declaring will be optional. Don't worry
Reply With Quote
  #9 (permalink)  
Old 05-28-2008, 02:26 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,706
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Quote:
Originally Posted by colin9876 View Post
Is there any advantage that Im missing apart from the speed?
It is less important than in the old days but memory usage was an issue so you used the smallest numeric type that offered the range of values needed. Also in the old days floating point ops were either done in software or in slower (than integer ops) hardware and as the machines were much slower overall performance suffered so you used integer working wherever possible.

Incidentally the main advantage that early supercomputers had came from their ability to do multiple floating point operations in parallel, known as vector processing. They were not necessarily much faster per se than ordinary (scalar processing) mainframes but had an architecture better suited to number crunching.

Types also offer code safety, especially if you can declare you own types. You cannot then assign an apple to an orange. This is less important coding by yourself but more important when working as part of a team. Also you can only do operations on a type that are supported by that type, so you can't add Booleans for example.

I am an advocate of strong typing (as long as a way round it exists when required!) but then I am also weird in that I dislike operator precedence and like to parenthesise my expressions so that they don't rely on it!
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
StringSplit and double-quotes issue Cableguy Questions & Help Needed 2 07-24-2008 07:05 PM
Double clicks on a cell in a table list, possible? davidcoderlab Questions & Help Needed 3 06-01-2008 03:09 PM
How to use double quotes in a text ? origami Questions & Help Needed 3 04-27-2008 07:58 AM
LoadCSV from a variable nsidney Questions & Help Needed 7 01-30-2008 02:29 AM
preventing double application launch Put Claude Questions & Help Needed 3 10-02-2007 02:52 PM


All times are GMT. The time now is 02:20 PM.


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