Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Basic4ppc Wishlist > Bug Reports
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Bug Reports Post about errors or bugs encountered.

Strange subroutine output

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-31-2008, 02:42 PM
Knows the basics
 
Join Date: May 2007
Location: Czech Republic
Posts: 72
Awards Showcase
Beta Tester 
Total Awards: 1
Default Strange subroutine output

Hi,
sometimes I need to fill in a string with a character to achieve a concrete length of this string. So I've written a simple subroutine, which is working for me for a quite long time. Now I found a problem when I use optimized compilation. You can see it on attached example.

Try to write for example number 1 to Input textbox and click on OK button. On the Result textbox should appear 00001 (subroutine fills it in 5 character length).
From IDE and from non optimized compilation it works. But if I use optimized compilation in the Result textbox is 001. Strange.

Has anybody some idea, please ?
Petr
Reply With Quote
  #2 (permalink)  
Old 01-31-2008, 03:00 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

It's because you have StrLength(inp) in your For condition. In the IDE it is calculated once at the start of the loop, in the compiler it is calculated each pass round the loop. This works

i = length - StrLength(inp)
For sdi = 1 To i
Reply With Quote
  #3 (permalink)  
Old 01-31-2008, 03:11 PM
Knows the basics
 
Join Date: May 2007
Location: Czech Republic
Posts: 72
Awards Showcase
Beta Tester 
Total Awards: 1
Default

You're very fast and you're right.
I didn't know about this. It means I must check all my old programs for it.
Thank you very much Agraham.
Petr
Reply With Quote
  #4 (permalink)  
Old 01-31-2008, 07:18 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,702
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

This will be fixed in the next release.
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 Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Strange cast error agraham Beta Versions 1 10-11-2008 06:43 PM
Viewing Intermediate Output Steve Questions (Windows Mobile) 4 08-14-2008 07:59 PM
Text output with scrollbar...? TWELVE Questions (Windows Mobile) 2 04-28-2008 09:37 AM
Returning subroutine error - Input string was not in the correct format HarleyM Questions (Windows Mobile) 4 10-20-2007 06:45 AM
Strange characters pmu5757 Questions (Windows Mobile) 2 09-30-2007 08:56 AM


All times are GMT. The time now is 03:13 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0